Replace foreach function by for, please try and report problem

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4900 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2017-02-04 21:43:23 +00:00
parent 6ed750b355
commit 6422dd096f
98 changed files with 606 additions and 606 deletions

View File

@@ -101,7 +101,7 @@ ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, Element
if (source_dir == destination_dir)
copy_itself = true;
foreach(QString str, source_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
for (QString str : source_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
{
if (copy_itself)
{
@@ -118,7 +118,7 @@ ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, Element
//Copy all elements found in source_dir to destination_dir
source_dir.setNameFilters(QStringList() << "*.elmt");
foreach(QString str, source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
for (QString str: source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
{
ElementsLocation sub_source(source.fileSystemPath() + "/" + str);
copyElement(sub_source, created_location);
@@ -211,7 +211,7 @@ ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, Elements
XmlElementCollection *project_collection = source.projectCollection();
QStringList directories_names = project_collection->directoriesNames( project_collection->directory(source.collectionPath(false)) );
foreach(QString name, directories_names)
for (QString name : directories_names)
{
ElementsLocation sub_source_dir(source.projectCollectionPath() + "/" + name);
copyDirectory(sub_source_dir, created_location);
@@ -219,7 +219,7 @@ ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, Elements
//Create all elements found in source to destination
QStringList elements_names = project_collection->elementsNames( project_collection->directory(source.collectionPath(false))) ;
foreach (QString name, elements_names)
for (QString name : elements_names)
{
ElementsLocation source_element(source.projectCollectionPath() + "/" + name);
copyElement(source_element, created_location);

View File

@@ -50,7 +50,7 @@ ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &pat
if (str_list.isEmpty()) return nullptr;
ElementCollectionItem *return_eci = this;
foreach (QString str, str_list)
for (QString str: str_list)
{
ElementCollectionItem *eci = return_eci->childWithCollectionName(str);
if (!eci)
@@ -74,7 +74,7 @@ ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &pat
ElementCollectionItem *ElementCollectionItem::childWithCollectionName(QString name) const
{
rowCount();
foreach (QStandardItem *qsi, directChilds()) {
for (QStandardItem *qsi: directChilds()) {
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
if (eci->name() == name)
return eci;
@@ -128,7 +128,7 @@ int ElementCollectionItem::rowForInsertItem(const QString &name)
return 0;
}
foreach (ElementCollectionItem *eci, child)
for (ElementCollectionItem *eci: child)
if (eci->name() > name)
return model()->indexFromItem(eci).row();
@@ -147,7 +147,7 @@ ElementCollectionItem *ElementCollectionItem::itemAtPath(const QString &path)
return nullptr;
ElementCollectionItem *match_eci = this;
foreach (QString str, str_list) {
for (QString str: str_list) {
ElementCollectionItem *eci = match_eci->childWithCollectionName(str);
if (!eci)
return nullptr;
@@ -166,7 +166,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::elementsDirectChild() cons
{
QList <ElementCollectionItem *> element_child;
foreach (QStandardItem *qsi, directChilds()) {
for (QStandardItem *qsi: directChilds()) {
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
if (eci->isElement())
element_child.append(eci);
@@ -183,7 +183,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::directoriesDirectChild() c
{
QList <ElementCollectionItem *> dir_child;
foreach (QStandardItem *qsi, directChilds()) {
for (QStandardItem *qsi: directChilds()) {
ElementCollectionItem *eci = static_cast<ElementCollectionItem *>(qsi);
if (eci->isDir())
dir_child.append(eci);
@@ -200,7 +200,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::elementsChild() const
{
QList <ElementCollectionItem *> list = elementsDirectChild();
foreach (ElementCollectionItem *eci, directoriesChild())
for (ElementCollectionItem *eci: directoriesChild())
list.append(eci->elementsDirectChild());
return list;
@@ -214,7 +214,7 @@ QList<ElementCollectionItem *> ElementCollectionItem::directoriesChild() const
{
QList<ElementCollectionItem *> list = directoriesDirectChild();
QList<ElementCollectionItem *> child_list;
foreach (ElementCollectionItem *eci, list) {
for (ElementCollectionItem *eci: list) {
child_list.append(eci->directoriesChild());
}

View File

@@ -236,7 +236,7 @@ void ElementsCollectionModel::loadCollections(bool common_collection, bool custo
list.append(items());
foreach (QETProject *project, projects) {
for (QETProject *project: projects) {
addProject(project, false);
list.append(projectItems(project));
}
@@ -310,7 +310,7 @@ void ElementsCollectionModel::addLocation(ElementsLocation location)
for (int i=0 ; i<rowCount() ; i++)
child_list.append(static_cast<ElementCollectionItem *>(item(i)));
foreach(ElementCollectionItem *eci, child_list) {
for (ElementCollectionItem *eci: child_list) {
if (eci->type() == FileElementCollectionItem::Type) {
FileElementCollectionItem *feci = static_cast<FileElementCollectionItem *>(eci);
@@ -393,14 +393,14 @@ void ElementsCollectionModel::highlightUnusedElement()
{
QList <ElementsLocation> unused;
foreach (QETProject *project, m_project_list)
for (QETProject *project: m_project_list)
unused.append(project->unusedElements());
QBrush brush;
brush.setStyle(Qt::Dense4Pattern);
brush.setColor(Qt::red);
foreach (ElementsLocation location, unused) {
for (ElementsLocation location: unused) {
QModelIndex index = indexFromLocation(location);
if (index.isValid()) {
QStandardItem *qsi = itemFromIndex(index);
@@ -452,7 +452,7 @@ QList<ElementCollectionItem *> ElementsCollectionModel::projectItems(QETProject
void ElementsCollectionModel::hideElement()
{
m_hide_element = true;
foreach(ElementCollectionItem *eci, items()) {
for (ElementCollectionItem *eci: items()) {
if (eci->isElement()) {
removeRow(eci->row(), indexFromItem(eci).parent());
}
@@ -514,7 +514,7 @@ void ElementsCollectionModel::elementIntegratedToCollection(QString path)
QETProject *project = nullptr;
//Get the owner project of the collection
foreach (QETProject *prj, m_project_list) {
for (QETProject *prj: m_project_list) {
if (prj->embeddedElementCollection() == collection) {
project = prj;
}
@@ -547,7 +547,7 @@ void ElementsCollectionModel::itemRemovedFromCollection(QString path)
QETProject *project = nullptr;
//Get the owner project of the collection
foreach (QETProject *prj, m_project_list) {
for (QETProject *prj: m_project_list) {
if (prj->embeddedElementCollection() == collection) {
project = prj;
}
@@ -575,7 +575,7 @@ void ElementsCollectionModel::updateItem(QString path)
QETProject *project = nullptr;
//Get the owner project of the collection
foreach (QETProject *prj, m_project_list) {
for (QETProject *prj: m_project_list) {
if (prj->embeddedElementCollection() == collection) {
project = prj;
}

View File

@@ -311,7 +311,7 @@ void ElementsCollectionWidget::editElement()
QETApp *app = QETApp::instance();
app->openElementLocations(QList<ElementsLocation>() << location);
foreach (QETElementEditor *element_editor, app->elementEditors())
for (QETElementEditor *element_editor: app->elementEditors())
connect(element_editor, &QETElementEditor::saveToLocation, this, &ElementsCollectionWidget::locationWasSaved);
}
@@ -442,7 +442,7 @@ void ElementsCollectionWidget::newElement()
elmt_wizard.preselectedLocation(loc);
elmt_wizard.exec();
foreach (QETElementEditor *element_editor, QETApp::instance()->elementEditors())
for (QETElementEditor *element_editor: QETApp::instance()->elementEditors())
connect(element_editor, &QETElementEditor::saveToLocation, this, &ElementsCollectionWidget::locationWasSaved);
}
@@ -609,12 +609,12 @@ void ElementsCollectionWidget::search()
hideCollection(true);
QStringList text_list = text.split("+", QString::SkipEmptyParts);
QModelIndexList match_index;
foreach (QString txt, text_list) {
for (QString txt: text_list) {
match_index << m_model->match(m_showed_index.isValid() ? m_model->index(0,0,m_showed_index) : m_model->index(0,0),
Qt::DisplayRole, QVariant(txt), -1, Qt::MatchContains | Qt::MatchRecursive);
}
foreach(QModelIndex index, match_index)
for (QModelIndex index: match_index)
showAndExpandItem(index);
}

View File

@@ -297,7 +297,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
QDir dir (fileSystemPath());
//Get all directory in this directory.
foreach(QString str, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
for (QString str: dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
{
FileElementCollectionItem *feci = new FileElementCollectionItem();
appendRow(feci);
@@ -311,7 +311,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
//Get all elmt file in this directory
dir.setNameFilters(QStringList() << "*.elmt");
foreach(QString str, dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
for (QString str: dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
{
FileElementCollectionItem *feci = new FileElementCollectionItem();
appendRow(feci);

View File

@@ -136,7 +136,7 @@ QDomElement XmlElementCollection::child(const QDomElement &parent_element, const
if (found_dom_element.isEmpty()) return QDomElement();
foreach (QDomElement elmt, found_dom_element)
for (QDomElement elmt: found_dom_element)
if (elmt.attribute("name") == child_name)
return elmt;
@@ -154,7 +154,7 @@ QDomElement XmlElementCollection::child(const QString &path) const
if (path_list.isEmpty()) return QDomElement();
QDomElement parent_element = root();
foreach (QString str, path_list)
for (QString str: path_list)
{
QDomElement child_element = child(parent_element, str);
@@ -198,7 +198,7 @@ QStringList XmlElementCollection::directoriesNames(const QDomElement &parent_ele
QList <QDomElement> childs = directories(parent_element);
QStringList names;
foreach (QDomElement child, childs)
for (QDomElement child: childs)
{
QString name = child.attribute("name");
if (!name.isEmpty())
@@ -239,7 +239,7 @@ QStringList XmlElementCollection::elementsNames(const QDomElement &parent_elemen
QList <QDomElement> childs = elements(parent_element);
QStringList names;
foreach (QDomElement child, childs)
for (QDomElement child: childs)
{
QString name = child.attribute("name");
if (!name.isEmpty())
@@ -325,7 +325,7 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
if (!dir.exists())
return QString();
foreach(QString str, splitted_path) {
for (QString str: splitted_path) {
QDomElement child_element = child(parent_element, str);
//Child doesn't exist, we create it
@@ -369,7 +369,7 @@ QString XmlElementCollection::addElement(ElementsLocation &location)
}
else if (location.isProject()) {
QString path;
foreach(QString str, splitted_path) {
for (QString str: splitted_path) {
if (path.isEmpty())
path = str;
else
@@ -585,7 +585,7 @@ QList<ElementsLocation> XmlElementCollection::elementsLocation(QDomElement dom_e
//get element childs
QList <QDomElement> element_list = elements(dom_element);
foreach (QDomElement elmt, element_list) {
for (QDomElement elmt: element_list) {
ElementsLocation location = domToLocation(elmt);
if (location.exist())
location_list << location;
@@ -594,7 +594,7 @@ QList<ElementsLocation> XmlElementCollection::elementsLocation(QDomElement dom_e
//get directory childs
QList <QDomElement> directory_list = directories(dom_element);
foreach (QDomElement dir, directory_list) {
for (QDomElement dir: directory_list) {
ElementsLocation location = domToLocation(dir);
if (location.exist())
location_list << location;
@@ -638,7 +638,7 @@ ElementsLocation XmlElementCollection::domToLocation(QDomElement dom_element) co
*/
void XmlElementCollection::cleanUnusedElement()
{
foreach (ElementsLocation loc, m_project->unusedElements())
for (ElementsLocation loc: m_project->unusedElements())
removeElement(loc.collectionPath(false));
}
@@ -705,7 +705,7 @@ ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, E
if (deep_copy)
{
//Append all directories of source to the new created directory
foreach(QString str, source_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
for (QString str: source_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
{
ElementsLocation sub_source(source.fileSystemPath() + "/" + str);
copyDirectory(sub_source, created_location);
@@ -713,7 +713,7 @@ ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, E
//Append all elements of source to the new created directory
source_dir.setNameFilters(QStringList() << "*.elmt");
foreach(QString str, source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
for (QString str: source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
{
ElementsLocation sub_source(source.fileSystemPath() + "/" + str);
copyElement(sub_source, created_location);

View File

@@ -227,7 +227,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
QList <QDomElement> dom_category = m_project->embeddedElementCollection()->directories(m_dom_element);
std::sort(dom_category.begin(), dom_category.end(), [](QDomElement a, QDomElement b){return (a.attribute("name") < b.attribute("name"));});
foreach (QDomElement element, dom_category)
for (QDomElement element: dom_category)
{
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
appendRow(xpeci);
@@ -242,7 +242,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
QList <QDomElement> dom_elements = m_project->embeddedElementCollection()->elements(m_dom_element);
std::sort(dom_elements.begin(), dom_elements.end(), [](QDomElement a, QDomElement b){return (a.attribute("name") < b.attribute("name"));});
foreach (QDomElement element, dom_elements)
for (QDomElement element: dom_elements)
{
XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem();
appendRow(xpeci);

View File

@@ -48,7 +48,7 @@ PropertiesEditorDockWidget::~PropertiesEditorDockWidget()
*/
void PropertiesEditorDockWidget::clear()
{
foreach (PropertiesEditorWidget *editor, m_editor_list)
for (PropertiesEditorWidget *editor: m_editor_list)
{
m_editor_list.removeOne(editor);
ui->m_main_vlayout->removeWidget(editor);
@@ -64,7 +64,7 @@ void PropertiesEditorDockWidget::clear()
*/
void PropertiesEditorDockWidget::apply()
{
foreach(PropertiesEditorWidget *editor, m_editor_list)
for (PropertiesEditorWidget *editor: m_editor_list)
editor->apply();
}
@@ -74,7 +74,7 @@ void PropertiesEditorDockWidget::apply()
*/
void PropertiesEditorDockWidget::reset()
{
foreach(PropertiesEditorWidget *editor, m_editor_list)
for (PropertiesEditorWidget *editor: m_editor_list)
editor->reset();
}

View File

@@ -56,7 +56,7 @@ void QetGraphicsHandlerUtility::drawHandler(QPainter *painter, const QPointF &po
* @param color2
*/
void QetGraphicsHandlerUtility::drawHandler(QPainter *painter, const QVector<QPointF> &points) {
foreach(QPointF point, points)
for (QPointF point: points)
drawHandler(painter, point);
}
@@ -78,7 +78,7 @@ bool QetGraphicsHandlerUtility::pointIsInHandler(const QPointF &point, const QPo
*/
int QetGraphicsHandlerUtility::pointIsHoverHandler(const QPointF &point, const QVector<QPointF> &vector) const
{
foreach (QPointF key_point, vector)
for (QPointF key_point: vector)
if (pointIsInHandler(point, key_point))
return vector.indexOf(key_point);
@@ -96,7 +96,7 @@ QVector<QRectF> QetGraphicsHandlerUtility::handlerRect(const QVector<QPointF> &v
{
QVector <QRectF> rect_vector;
foreach(QPointF point, vector)
for (QPointF point: vector)
rect_vector << getRect(point);
return rect_vector;

View File

@@ -154,7 +154,7 @@ QDomElement NumerotationContext::toXml(QDomDocument &d, QString str) {
*/
void NumerotationContext::fromXml(QDomElement &e) {
clear();
foreach(QDomElement qde, QET::findInDomElement(e, "part")) addValue(qde.attribute("type"), qde.attribute("value"), qde.attribute("increase").toInt(), qde.attribute("initialvalue").toInt());
for (QDomElement qde: QET::findInDomElement(e, "part")) addValue(qde.attribute("type"), qde.attribute("value"), qde.attribute("increase").toInt(), qde.attribute("initialvalue").toInt());
}
/**

View File

@@ -106,21 +106,21 @@ void AutoNumberingDockWidget::setContext() {
ui->m_conductor_cb->addItem("");
QList <QString> keys_conductor = m_project->conductorAutoNum().keys();
if (!keys_conductor.isEmpty()) {
foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); }
for (QString str: keys_conductor) { ui->m_conductor_cb-> addItem(str); }
}
//Element Combobox
ui->m_element_cb->addItem("");
QList <QString> keys_element = m_project->elementAutoNum().keys();
if (!keys_element.isEmpty()) {
foreach (QString str, keys_element) {ui->m_element_cb -> addItem(str);}
for (QString str: keys_element) {ui->m_element_cb -> addItem(str);}
}
//Folio Combobox
ui->m_folio_cb->addItem("");
QList <QString> keys_folio = m_project->folioAutoNum().keys();
if (!keys_folio.isEmpty()) {
foreach (QString str, keys_folio) { ui->m_folio_cb -> addItem(str);}
for (QString str: keys_folio) { ui->m_folio_cb -> addItem(str);}
}
this->setActive();
@@ -178,7 +178,7 @@ void AutoNumberingDockWidget::conductorAutoNumChanged() {
ui->m_conductor_cb->addItem("");
QList <QString> keys_conductor = m_project->conductorAutoNum().keys();
if (!keys_conductor.isEmpty()) {
foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); }
for (QString str: keys_conductor) { ui->m_conductor_cb-> addItem(str); }
}
setActive();
}
@@ -209,7 +209,7 @@ void AutoNumberingDockWidget::elementAutoNumChanged() {
ui->m_element_cb->addItem("");
QList <QString> keys_element = m_project->elementAutoNum().keys();
if (!keys_element.isEmpty()) {
foreach (QString str, keys_element) {ui->m_element_cb -> addItem(str);}
for (QString str: keys_element) {ui->m_element_cb -> addItem(str);}
}
setActive();
}
@@ -237,7 +237,7 @@ void AutoNumberingDockWidget::folioAutoNumChanged() {
ui->m_folio_cb->addItem("");
QList <QString> keys_folio = m_project->folioAutoNum().keys();
if (!keys_folio.isEmpty()) {
foreach (QString str, keys_folio) { ui->m_folio_cb -> addItem(str);}
for (QString str: keys_folio) { ui->m_folio_cb -> addItem(str);}
}
setActive();
}

View File

@@ -106,7 +106,7 @@ void AutoNumberingManagementW::on_m_apply_folios_rb_clicked() {
if (ui->m_from_folios_cb->count()<=0) {
ui->m_from_folios_cb->clear();
ui->m_from_folios_cb->addItem("");
foreach (Diagram *diagram, project_->diagrams()){
for (Diagram *diagram: project_->diagrams()){
if (diagram->title() != "")
ui->m_from_folios_cb->addItem(diagram->title(),diagram->folioIndex());
else ui->m_from_folios_cb->addItem(QString::number(diagram->folioIndex()),diagram->folioIndex());

View File

@@ -51,7 +51,7 @@ FolioAutonumberingW::~FolioAutonumberingW()
* construct autonums in the comboBox selected in the @autonum_chooser QcomboBox
*/
void FolioAutonumberingW::setContext(QList <QString> autonums) {
foreach (QString str, autonums) { ui->m_autonums_cb->addItem(str);}
for (QString str: autonums) { ui->m_autonums_cb->addItem(str);}
}
/**
@@ -123,7 +123,7 @@ void FolioAutonumberingW::on_m_autonumber_tabs_rb_clicked() {
if (ui->m_from_cb->count()<=0){
ui->m_from_cb->clear();
ui->m_from_cb->addItem("");
foreach (Diagram *diagram, project_->diagrams()){
for (Diagram *diagram: project_->diagrams()){
ui->m_from_cb->addItem(diagram->title());
}
}

View File

@@ -105,7 +105,7 @@ void SelectAutonumW::setContext(const NumerotationContext &context) {
*/
NumerotationContext SelectAutonumW::toNumContext() const {
NumerotationContext nc;
foreach (NumPartEditorW *npew, num_part_list_) nc << npew -> toNumContext();
for (NumPartEditorW *npew: num_part_list_) nc << npew -> toNumContext();
return nc;
}
@@ -228,7 +228,7 @@ void SelectAutonumW::applyEnableOnContextChanged(QString) {
void SelectAutonumW::applyEnable(bool b) {
if (b){
bool valid= true;
foreach (NumPartEditorW *npe, num_part_list_) if (!npe -> isValid()) valid= false;
for (NumPartEditorW *npe: num_part_list_) if (!npe -> isValid()) valid= false;
ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(valid);
}
else {

View File

@@ -692,7 +692,7 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock(const DiagramContext &i
// Our final DiagramContext is the initial one (which is supposed to bring
// project-wide properties), overridden by the "additional fields" one...
DiagramContext context = initial_context;
foreach (QString key, additional_fields_.keys()) {
for (QString key: additional_fields_.keys()) {
context.addValue(key, additional_fields_[key]);
}

View File

@@ -85,7 +85,7 @@ void ConductorAutoNumerotation::applyText(QString t)
if (!m_parent_undo)
undo->setText(QObject::tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
foreach (Conductor *cond, conductor_list)
for (Conductor *cond: conductor_list)
{
ConductorProperties cp2 = cond -> properties();
old_value.setValue(cp2);
@@ -107,7 +107,7 @@ void ConductorAutoNumerotation::numeratePotential()
{
ConductorProperties cp = conductor_list.first()->properties();
bool properties_equal = true;
foreach (const Conductor *conductor, conductor_list)
for (const Conductor *conductor: conductor_list)
{
if (conductor->properties() != cp)
properties_equal = false;
@@ -122,7 +122,7 @@ void ConductorAutoNumerotation::numeratePotential()
QStringList text_list;
QStringList formula_list;
foreach (const Conductor *cc, conductor_list)
for (const Conductor *cc: conductor_list)
{
ConductorProperties cp = cc->properties();
text_list << cp.text;
@@ -134,7 +134,7 @@ void ConductorAutoNumerotation::numeratePotential()
if (QET::eachStrIsEqual(text_list) && QET::eachStrIsEqual(formula_list))
{
QList<ConductorProperties> cp_list;
foreach(Conductor *c, conductor_list)
for (Conductor *c: conductor_list)
cp_list<<c->properties();
ConductorProperties cp = m_conductor->properties();

View File

@@ -39,7 +39,7 @@ ConductorProfile::ConductorProfile(Conductor *conductor) {
ConductorProfile::ConductorProfile(const ConductorProfile &c) {
beginOrientation = c.beginOrientation;
endOrientation = c.endOrientation;
foreach(ConductorSegmentProfile *csp, c.segments) {
for (ConductorSegmentProfile *csp: c.segments) {
segments << new ConductorSegmentProfile(*csp);
}
}
@@ -57,7 +57,7 @@ ConductorProfile &ConductorProfile::operator=(const ConductorProfile &c) {
// copie les informations de l'autre profil de conducteur
beginOrientation = c.beginOrientation;
endOrientation = c.endOrientation;
foreach(ConductorSegmentProfile *csp, c.segments) {
for (ConductorSegmentProfile *csp: c.segments) {
segments << new ConductorSegmentProfile(*csp);
}
return(*this);
@@ -75,14 +75,14 @@ bool ConductorProfile::isNull() const {
/// supprime les segments du profil de conducteur
void ConductorProfile::setNull() {
foreach(ConductorSegmentProfile *csp, segments) delete csp;
for (ConductorSegmentProfile *csp: segments) delete csp;
segments.clear();
}
/// @return la largeur occupee par le conducteur
qreal ConductorProfile::width() const {
qreal width = 0.0;
foreach(ConductorSegmentProfile *csp, segments) {
for (ConductorSegmentProfile *csp: segments) {
if (csp -> isHorizontal) width += csp -> length;
}
return(width);
@@ -91,7 +91,7 @@ qreal ConductorProfile::width() const {
/// @return la hauteur occupee par le conducteur
qreal ConductorProfile::height() const{
qreal height = 0.0;
foreach(ConductorSegmentProfile *csp, segments) {
for (ConductorSegmentProfile *csp: segments) {
if (!csp -> isHorizontal) height += csp -> length;
}
return(height);
@@ -104,7 +104,7 @@ qreal ConductorProfile::height() const{
uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const {
if (type == QET::Both) return(segments.count());
uint nb_seg = 0;
foreach(ConductorSegmentProfile *csp, segments) {
for (ConductorSegmentProfile *csp: segments) {
if (type == QET::Horizontal && csp -> isHorizontal) ++ nb_seg;
else if (type == QET::Vertical && !csp -> isHorizontal) ++ nb_seg;
}
@@ -114,7 +114,7 @@ uint ConductorProfile::segmentsCount(QET::ConductorSegmentType type) const {
/// @return les segments horizontaux de ce profil
QList<ConductorSegmentProfile *> ConductorProfile::horizontalSegments() {
QList<ConductorSegmentProfile *> segments_list;
foreach(ConductorSegmentProfile *csp, segments) {
for (ConductorSegmentProfile *csp: segments) {
if (csp -> isHorizontal) segments_list << csp;
}
return(segments_list);
@@ -123,7 +123,7 @@ QList<ConductorSegmentProfile *> ConductorProfile::horizontalSegments() {
/// @return les segments verticaux de ce profil
QList<ConductorSegmentProfile *> ConductorProfile::verticalSegments() {
QList<ConductorSegmentProfile *> segments_list;
foreach(ConductorSegmentProfile *csp, segments) {
for (ConductorSegmentProfile *csp: segments) {
if (!csp -> isHorizontal) segments_list << csp;
}
return(segments_list);
@@ -136,7 +136,7 @@ void ConductorProfile::fromConductor(Conductor *conductor) {
// supprime les segments precedents
setNull();
foreach(ConductorSegment *conductor_segment, conductor -> segmentsList()) {
for (ConductorSegment *conductor_segment: conductor -> segmentsList()) {
segments << new ConductorSegmentProfile(conductor_segment);
}
beginOrientation = conductor -> terminal1 -> orientation();
@@ -150,7 +150,7 @@ void ConductorProfile::fromConductor(Conductor *conductor) {
*/
QDebug &operator<<(QDebug d, ConductorProfile &t) {
d << "ConductorProfile {";
foreach(ConductorSegmentProfile *csp, t.segments) {
for (ConductorSegmentProfile *csp: t.segments) {
d << "CSP" << (csp -> isHorizontal ? "horizontal" : "vertical") << ":" << csp -> length << ",";
}
d << "}";

View File

@@ -412,7 +412,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
bool equal = true;
//Color
QColor c_value = list.first().color;
foreach(ConductorProperties cp, list)
for (ConductorProperties cp: list)
{
if (cp.color != c_value)
equal = false;
@@ -423,7 +423,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//text
QString s_value = list.first().text;
foreach(ConductorProperties cp, list)
for (ConductorProperties cp: list)
{
if (cp.text != s_value)
equal = false;
@@ -434,7 +434,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//formula
s_value = list.first().m_formula;
foreach(ConductorProperties cp, list)
for (ConductorProperties cp: list)
{
if (cp.m_formula != s_value)
equal = false;
@@ -445,7 +445,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//function
s_value = list.first().m_function;
foreach(ConductorProperties cp, list)
for (ConductorProperties cp: list)
{
if (cp.m_function != s_value)
equal = false;
@@ -456,7 +456,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//Tension protocol
s_value = list.first().m_tension_protocol;
foreach(ConductorProperties cp, list)
for (ConductorProperties cp: list)
{
if (cp.m_tension_protocol != s_value)
equal = false;
@@ -467,7 +467,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//text size
int i_value = list.first().text_size;
foreach(ConductorProperties cp, list)
for (ConductorProperties cp: list)
{
if (cp.text_size != i_value)
equal = false;
@@ -478,7 +478,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//conductor size
double d_value = list.first().cond_size;
foreach(ConductorProperties cp, list)
for (ConductorProperties cp: list)
{
if (cp.cond_size != d_value)
equal = false;
@@ -489,7 +489,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//show text
bool b_value = list.first().m_show_text;
foreach(ConductorProperties cp, list)
for (ConductorProperties cp: list)
{
if (cp.m_show_text != b_value)
equal = false;
@@ -500,7 +500,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//One text per folio
b_value = list.first().m_one_text_per_folio;
foreach(ConductorProperties cp, list)
for (ConductorProperties cp: list)
{
if (cp.m_one_text_per_folio != b_value)
equal = false;
@@ -511,7 +511,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//Text rotation for vertical conducor
d_value = list.first().verti_rotate_text;
foreach(ConductorProperties cp, list)
for (ConductorProperties cp: list)
{
if (cp.verti_rotate_text != d_value)
equal = false;
@@ -522,7 +522,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//Text rotation for horizontal conducor
d_value = list.first().horiz_rotate_text;
foreach(ConductorProperties cp, list)
for (ConductorProperties cp: list)
{
if (cp.horiz_rotate_text != d_value)
equal = false;
@@ -592,7 +592,7 @@ void ConductorProperties::readStyle(const QString &style_string) {
QStringList styles = style_string.split(";", QString::SkipEmptyParts);
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
foreach (QString style_str, styles) {
for (QString style_str: styles) {
if (rx.exactMatch(style_str)) {
QString style_name = rx.cap(1);
QString style_value = rx.cap(2);

View File

@@ -70,7 +70,7 @@ ConfigDialog::~ConfigDialog() {
*/
void ConfigDialog::buildPagesList() {
pages_list -> clear();
foreach(ConfigPage *page, pages) {
for (ConfigPage *page: pages) {
addPageToList(page);
}
}
@@ -90,7 +90,7 @@ void ConfigDialog::addPageToList(ConfigPage *page) {
Applique la configuration de toutes les pages
*/
void ConfigDialog::applyConf() {
foreach(ConfigPage *page, pages) {
for (ConfigPage *page: pages) {
page -> applyConf();
}
accept();

View File

@@ -155,7 +155,7 @@ void NewDiagramPage::applyConf() {
// default xref properties
QHash <QString, XRefProperties> hash_xrp = xrefpw -> properties();
foreach (QString key, hash_xrp.keys()) {
for (QString key: hash_xrp.keys()) {
XRefProperties xrp = hash_xrp[key];
QString str("diagrameditor/defaultxref");
xrp.toSettings(settings, str += key);

View File

@@ -107,7 +107,7 @@ Diagram::~Diagram() {
// list removable items
QList<QGraphicsItem *> deletable_items;
foreach(QGraphicsItem *qgi, items()) {
for (QGraphicsItem *qgi: items()) {
if (qgi -> parentItem()) continue;
if (qgraphicsitem_cast<Conductor *>(qgi)) continue;
deletable_items << qgi;
@@ -251,7 +251,7 @@ void Diagram::keyPressEvent(QKeyEvent *e)
if (!this->selectedContent().items(255).isEmpty()) {
switch(e -> key()) {
case Qt::Key_Left:
foreach (Element *item, selectedContent().elements) {
for (Element *item: selectedContent().elements) {
left_position = item->mapRectFromScene(item->boundingRect()).x();
if (left_position >= this->sceneRect().left() - item->boundingRect().width())
return;
@@ -260,7 +260,7 @@ void Diagram::keyPressEvent(QKeyEvent *e)
break;
case Qt::Key_Right: movement = QPointF(+xGrid, 0.0); break;
case Qt::Key_Up:
foreach (Element *item, selectedContent().elements) {
for (Element *item:selectedContent().elements) {
top_position = item->mapRectFromScene(item->boundingRect()).y();
if (top_position >= this->sceneRect().top() - item->boundingRect().height())
return;
@@ -382,14 +382,14 @@ bool Diagram::toPaintDevice(QPaintDevice &pix, int width, int height, Qt::Aspect
// deselectionne tous les elements
QList<QGraphicsItem *> selected_elmts = selectedItems();
foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(false);
for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(false);
// effectue le rendu lui-meme
render(&p, QRect(QPoint(0, 0), image_size), source_area, aspectRatioMode);
p.end();
// restaure les elements selectionnes
foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(true);
for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(true);
return(true);
}
@@ -438,7 +438,7 @@ QList < QSet <Conductor *> > Diagram::potentials() {
do {
QSet <Conductor *> one_potential = conductors_list.first() -> relatedPotentialConductors();
one_potential << conductors_list.takeFirst();
foreach (Conductor *c, one_potential) conductors_list.removeOne(c);
for (Conductor *c: one_potential) conductors_list.removeOne(c);
potential_List << one_potential;
} while (!conductors_list.empty());
@@ -545,7 +545,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
QList<QGraphicsItem *> list_items = items();
;
// Determine les elements a "XMLiser"
foreach(QGraphicsItem *qgi, list_items) {
for (QGraphicsItem *qgi: list_items) {
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
if (whole_content) list_elements << elmt;
else if (elmt -> isSelected()) list_elements << elmt;
@@ -574,7 +574,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
// enregistrement des elements
if (!list_elements.isEmpty()) {
QDomElement elements = document.createElement("elements");
foreach(Element *elmt, list_elements) {
for (Element *elmt: list_elements) {
elements.appendChild(elmt -> toXml(document, table_adr_id));
}
racine.appendChild(elements);
@@ -583,7 +583,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
// enregistrement des conducteurs
if (!list_conductors.isEmpty()) {
QDomElement conductors = document.createElement("conductors");
foreach(Conductor *cond, list_conductors) {
for (Conductor *cond: list_conductors) {
conductors.appendChild(cond -> toXml(document, table_adr_id));
}
racine.appendChild(conductors);
@@ -592,7 +592,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
// enregistrement des champs de texte
if (!list_texts.isEmpty()) {
QDomElement inputs = document.createElement("inputs");
foreach(DiagramTextItem *dti, list_texts) {
for (DiagramTextItem *dti: list_texts) {
inputs.appendChild(dti -> toXml(document));
}
racine.appendChild(inputs);
@@ -601,7 +601,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
// save of images
if (!list_images.isEmpty()) {
QDomElement images = document.createElement("images");
foreach (DiagramImageItem *dii, list_images) {
for (DiagramImageItem *dii: list_images) {
images.appendChild(dii -> toXml(document));
}
racine.appendChild(images);
@@ -610,7 +610,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
// save of basic shapes
if (!list_shapes.isEmpty()) {
QDomElement shapes = document.createElement("shapes");
foreach (QetShapeItem *dii, list_shapes) {
for (QetShapeItem *dii: list_shapes) {
shapes.appendChild(dii -> toXml(document));
}
racine.appendChild(shapes);
@@ -768,7 +768,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
//in the embedded collection of this project
if (other_project && other_project != m_project) {
ElementCollectionHandler ech;
foreach (QDomElement element_xml, QET::findInDomElement(root, "elements", "element")) {
for (QDomElement element_xml: QET::findInDomElement(root, "elements", "element")) {
if (!Element::valideXml(element_xml)) continue;
QString type_id = element_xml.attribute("type");
@@ -783,7 +783,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
//Load all elements from the XML
QList<Element *> added_elements;
QHash<int, Terminal *> table_adr_id;
foreach (QDomElement element_xml, QET::findInDomElement(root, "elements", "element"))
for (QDomElement element_xml: QET::findInDomElement(root, "elements", "element"))
{
if (!Element::valideXml(element_xml)) continue;
@@ -822,7 +822,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
// Load text
QList<IndependentTextItem *> added_texts;
foreach (QDomElement text_xml, QET::findInDomElement(root, "inputs", "input")) {
for (QDomElement text_xml: QET::findInDomElement(root, "inputs", "input")) {
IndependentTextItem *iti = new IndependentTextItem();
iti -> fromXml(text_xml);
addItem(iti);
@@ -831,7 +831,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
// Load image
QList<DiagramImageItem *> added_images;
foreach (QDomElement image_xml, QET::findInDomElement(root, "images", "image")) {
for (QDomElement image_xml: QET::findInDomElement(root, "images", "image")) {
DiagramImageItem *dii = new DiagramImageItem ();
dii -> fromXml(image_xml);
addItem(dii);
@@ -840,7 +840,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
// Load shape
QList<QetShapeItem *> added_shapes;
foreach (QDomElement shape_xml, QET::findInDomElement(root, "shapes", "shape")) {
for (QDomElement shape_xml: QET::findInDomElement(root, "shapes", "shape")) {
QetShapeItem *dii = new QetShapeItem (QPointF(0,0));
dii -> fromXml(shape_xml);
addItem(dii);
@@ -849,7 +849,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
// Load conductor
QList<Conductor *> added_conductors;
foreach (QDomElement f, QET::findInDomElement(root, "conductors", "conductor"))
for (QDomElement f: QET::findInDomElement(root, "conductors", "conductor"))
{
if (!Conductor::valideXml(f)) continue;
@@ -880,15 +880,15 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
if (position != QPointF()) {
QList<QGraphicsItem *> added_items;
foreach (Element *added_element, added_elements ) added_items << added_element;
foreach (Conductor *added_cond, added_conductors) added_items << added_cond;
foreach (QetShapeItem *added_shape, added_shapes ) added_items << added_shape;
foreach (DiagramTextItem *added_text, added_texts ) added_items << added_text;
foreach (DiagramImageItem *added_image, added_images ) added_items << added_image;
for (Element *added_element: added_elements ) added_items << added_element;
for (Conductor *added_cond: added_conductors) added_items << added_cond;
for (QetShapeItem *added_shape: added_shapes ) added_items << added_shape;
for (DiagramTextItem *added_text: added_texts ) added_items << added_text;
for (DiagramImageItem *added_image: added_images ) added_items << added_image;
//Get the top left corner of the rectangle that contain all added items
QRectF items_rect;
foreach (QGraphicsItem *item, added_items) {
for (QGraphicsItem *item: added_items) {
items_rect = items_rect.united(item -> mapToScene(item -> boundingRect()).boundingRect());
}
@@ -897,7 +897,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
position.y() - point_.y()));
//Translate all added items
foreach (QGraphicsItem *qgi, added_items)
for (QGraphicsItem *qgi: added_items)
qgi -> setPos( qgi -> pos() += pos_);
}
@@ -923,7 +923,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
* @param type of sequential
*/
void Diagram::folioSequentialsFromXml(const QDomElement &root, QHash<QString, QStringList>* hash, QString folioSeq, QString seq, QString type, QString autonumFolioSeqType) {
foreach (QDomElement folioSeqAutoNum, QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) {
for (QDomElement folioSeqAutoNum: QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) {
for(QDomElement folioseq = folioSeqAutoNum.firstChildElement(type); !folioseq.isNull(); folioseq = folioseq.nextSiblingElement(type)) {
QString title = folioseq.attribute("title");
QStringList list;
@@ -987,10 +987,10 @@ QDomElement Diagram::writeXml(QDomDocument &xml_doc) const {
*/
void Diagram::refreshContents() {
foreach (Element *elmt, elements())
for (Element *elmt: elements())
elmt->initLink(project());
foreach (Conductor *conductor, conductors())
for (Conductor *conductor: conductors())
conductor->refreshText();
}
@@ -1127,7 +1127,7 @@ void Diagram::selectAll() {
if (items().isEmpty()) return;
blockSignals(true);
foreach(QGraphicsItem *qgi, items()) qgi -> setSelected(true);
for (QGraphicsItem *qgi: items()) qgi -> setSelected(true);
blockSignals(false);
emit(selectionChanged());
}
@@ -1148,7 +1148,7 @@ void Diagram::invertSelection() {
if (items().isEmpty()) return;
blockSignals(true);
foreach (QGraphicsItem *item, items()) item -> setSelected(!item -> isSelected());
for (QGraphicsItem *item: items()) item -> setSelected(!item -> isSelected());
blockSignals(false);
emit(selectionChanged());
}
@@ -1159,11 +1159,11 @@ void Diagram::invertSelection() {
* in their labels.
*/
void Diagram::updateLabels() {
foreach (Element *elmt, elements()) {
for (Element *elmt: elements()) {
if (elmt->elementInformations()["label"].toString().contains(("%F")))
elmt->updateLabel();
}
foreach (Conductor *cnd, content().conductors()) {
for (Conductor *cnd: content().conductors()) {
cnd->refreshText();
}
}
@@ -1341,7 +1341,7 @@ QString Diagram::title() const {
*/
QList<CustomElement *> Diagram::customElements() const {
QList<CustomElement *> elements_list;
foreach(QGraphicsItem *qgi, items()) {
for (QGraphicsItem *qgi: items()) {
if (CustomElement *elmt = qgraphicsitem_cast<CustomElement *>(qgi)) {
elements_list << elmt;
}
@@ -1351,7 +1351,7 @@ QList<CustomElement *> Diagram::customElements() const {
QList <Element *> Diagram::elements() const {
QList<Element *> element_list;
foreach (QGraphicsItem *qgi, items()) {
for (QGraphicsItem *qgi: items()) {
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi))
element_list <<elmt;
}
@@ -1364,7 +1364,7 @@ QList <Element *> Diagram::elements() const {
*/
QList <Conductor *> Diagram::conductors() const {
QList<Conductor *> cnd_list;
foreach (QGraphicsItem *qgi, items()) {
for (QGraphicsItem *qgi: items()) {
if (Conductor *cnd = qgraphicsitem_cast<Conductor *>(qgi))
cnd_list <<cnd;
}
@@ -1433,7 +1433,7 @@ void Diagram::endMoveElementTexts() {
@return true si l'element location est utilise sur ce schema, false sinon
*/
bool Diagram::usesElement(const ElementsLocation &location) {
foreach(CustomElement *element, customElements()) {
for (CustomElement *element: customElements()) {
if (element -> location() == location) {
return(true);
}
@@ -1455,7 +1455,7 @@ bool Diagram::usesTitleBlockTemplate(const QString &name) {
* Freeze every existent element label.
*/
void Diagram::freezeElements(bool freeze) {
foreach (Element *elmt, elements()) {
for (Element *elmt: elements()) {
elmt->freezeLabel(freeze);
}
}
@@ -1465,7 +1465,7 @@ void Diagram::freezeElements(bool freeze) {
* Unfreeze every existent element label.
*/
void Diagram::unfreezeElements() {
foreach (Element *elmt, elements()) {
for (Element *elmt: elements()) {
elmt->freezeLabel(false);
}
}
@@ -1491,7 +1491,7 @@ bool Diagram::freezeNewElements() {
* Freeze every existent conductor label.
*/
void Diagram::freezeConductors(bool freeze) {
foreach (Conductor *cnd, conductors()) {
for (Conductor *cnd: conductors()) {
cnd->setFreezeLabel(freeze);
}
}
@@ -1595,7 +1595,7 @@ QPointF Diagram::snapToGrid(const QPointF &p)
@param dt true pour afficher les bornes, false sinon
*/
void Diagram::setDrawTerminals(bool dt) {
foreach(QGraphicsItem *qgi, items()) {
for (QGraphicsItem *qgi: items()) {
if (Terminal *t = qgraphicsitem_cast<Terminal *>(qgi)) {
t -> setVisible(dt);
}
@@ -1616,7 +1616,7 @@ void Diagram::setDrawColoredConductors(bool dcc) {
*/
QSet<Conductor *> Diagram::selectedConductors() const {
QSet<Conductor *> conductors_set;
foreach(QGraphicsItem *qgi, selectedItems()) {
for (QGraphicsItem *qgi: selectedItems()) {
if (Conductor *c = qgraphicsitem_cast<Conductor *>(qgi)) {
conductors_set << c;
}
@@ -1630,7 +1630,7 @@ QSet<Conductor *> Diagram::selectedConductors() const {
*/
QSet<DiagramTextItem *> Diagram::selectedTexts() const {
QSet<DiagramTextItem *> selected_texts;
foreach(QGraphicsItem *item, selectedItems()) {
for (QGraphicsItem *item: selectedItems()) {
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
selected_texts << cti;
} else if (ElementTextItem *eti = qgraphicsitem_cast<ElementTextItem *>(item)) {
@@ -1648,7 +1648,7 @@ QSet<DiagramTextItem *> Diagram::selectedTexts() const {
*/
QSet<ConductorTextItem *> Diagram::selectedConductorTexts() const {
QSet<ConductorTextItem *> selected_texts;
foreach(QGraphicsItem *item, selectedItems()) {
for (QGraphicsItem *item: selectedItems()) {
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
selected_texts << cti;
}
@@ -1662,7 +1662,7 @@ QSet<ConductorTextItem *> Diagram::selectedConductorTexts() const {
*/
QSet<ElementTextItem*> Diagram::selectedElementTexts() const {
QSet<ElementTextItem *> selected_texts;
foreach(QGraphicsItem *item, selectedItems()) {
for (QGraphicsItem *item: selectedItems()) {
if (ElementTextItem *cti = qgraphicsitem_cast< ElementTextItem*>(item)) {
selected_texts << cti;
}
@@ -1750,7 +1750,7 @@ bool Diagram::isReadOnly() const
*/
DiagramContent Diagram::content() const {
DiagramContent dc;
foreach(QGraphicsItem *qgi, items()) {
for (QGraphicsItem *qgi: items()) {
if (Element *e = qgraphicsitem_cast<Element *>(qgi)) {
dc.elements << e;
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(qgi)) {
@@ -1769,7 +1769,7 @@ DiagramContent Diagram::selectedContent() {
DiagramContent dc;
// recupere les elements deplaces
foreach (QGraphicsItem *item, selectedItems()) {
for (QGraphicsItem *item: selectedItems()) {
if (Element *elmt = qgraphicsitem_cast<Element *>(item)) {
dc.elements << elmt;
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(item)) {
@@ -1790,9 +1790,9 @@ DiagramContent Diagram::selectedContent() {
}
// pour chaque element deplace, determine les conducteurs qui seront modifies
foreach(Element *elmt, dc.elements) {
foreach(Terminal *terminal, elmt -> terminals()) {
foreach(Conductor *conductor, terminal -> conductors()) {
for (Element *elmt: dc.elements) {
for (Terminal *terminal: elmt -> terminals()) {
for (Conductor *conductor: terminal -> conductors()) {
Terminal *other_terminal;
if (conductor -> terminal1 == terminal) {
other_terminal = conductor -> terminal2;
@@ -1818,7 +1818,7 @@ DiagramContent Diagram::selectedContent() {
et qu'au moins l'un d'entre eux peut etre pivote.
*/
bool Diagram::canRotateSelection() const {
foreach(QGraphicsItem * qgi, selectedItems()) {
for (QGraphicsItem * qgi: selectedItems()) {
if (qgraphicsitem_cast<IndependentTextItem *>(qgi) ||
qgraphicsitem_cast<ConductorTextItem *>(qgi) ||
qgraphicsitem_cast<DiagramImageItem *>(qgi) ||

View File

@@ -81,12 +81,12 @@ void DeleteElementsCommand::undo()
{
diagram -> showMe();
foreach(QGraphicsItem *item, removed_content.items())
for (QGraphicsItem *item: removed_content.items())
diagram->addItem(item);
//We relink element after every element was added to diagram
foreach(Element *e, removed_content.elements)
foreach (Element *elmt, m_link_hash[e])
for (Element *e: removed_content.elements)
for (Element *elmt: m_link_hash[e])
e -> linkToElement(elmt);
}
@@ -98,7 +98,7 @@ void DeleteElementsCommand::redo()
{
diagram -> showMe();
foreach(Conductor *c, removed_content.conductors(DiagramContent::AnyConductor))
for (Conductor *c: removed_content.conductors(DiagramContent::AnyConductor))
{
//If option one text per folio is enable, and the text item of
//current conductor is visible (that mean the conductor have the single displayed text)
@@ -113,14 +113,14 @@ void DeleteElementsCommand::redo()
}
}
foreach(Element *e, removed_content.elements)
for (Element *e: removed_content.elements)
{
//Get linked element, for relink it at undo
if (!e->linkedElements().isEmpty())
m_link_hash.insert(e, e->linkedElements());
}
foreach(QGraphicsItem *item, removed_content.items())
for (QGraphicsItem *item: removed_content.items())
diagram->removeItem(item);
}
@@ -158,7 +158,7 @@ void PasteDiagramCommand::undo()
{
diagram -> showMe();
foreach(QGraphicsItem *item, content.items(filter))
for (QGraphicsItem *item: content.items(filter))
diagram->removeItem(item);
}
@@ -175,7 +175,7 @@ void PasteDiagramCommand::redo()
first_redo = false;
//this is the first paste, we do some actions for the new element
foreach(Element *e, content.elements) {
for (Element *e: content.elements) {
//make new uuid, because old uuid are the uuid of the copied element
e -> newUuid();
@@ -205,7 +205,7 @@ void PasteDiagramCommand::redo()
eti -> setPlainText("_");
//Reset the text of conductors
foreach (Conductor *c, content.conductorsToMove) {
for (Conductor *c: content.conductorsToMove) {
ConductorProperties cp = c -> properties();
cp.text = c->diagram() ? c -> diagram() -> defaultConductorProperties.text : "_";
c -> setProperties(cp);
@@ -214,14 +214,14 @@ void PasteDiagramCommand::redo()
}
}
else {
foreach (QGraphicsItem *item, content.items(filter)) {
for (QGraphicsItem *item: content.items(filter)) {
diagram->item_paste = true;
diagram->addItem(item);
diagram->item_paste = false;
}
}
foreach (QGraphicsItem *qgi, content.items())
for (QGraphicsItem *qgi: content.items())
qgi -> setSelected(true);
}
@@ -335,7 +335,7 @@ void MoveElementsCommand::move(const QPointF &actual_movement) {
typedef DiagramContent dc;
//Move every movable item, except conductor
foreach (QGraphicsItem *qgi, content_to_move.items(dc::Elements | dc::TextFields | dc::Images | dc::Shapes)) {
for (QGraphicsItem *qgi: content_to_move.items(dc::Elements | dc::TextFields | dc::Images | dc::Shapes)) {
//If curent item have parent, and parent item is in content_to_move
//we don't apply movement to this item, because this item will be moved by is parent.
if (qgi->parentItem()) {
@@ -349,12 +349,12 @@ void MoveElementsCommand::move(const QPointF &actual_movement) {
}
// Move some conductors
foreach(Conductor *conductor, content_to_move.conductorsToMove) {
for (Conductor *conductor: content_to_move.conductorsToMove) {
setupAnimation(conductor, "pos", conductor->pos(), conductor->pos() + actual_movement);
}
// Recalcul the path of other conductor
foreach(Conductor *conductor, content_to_move.conductorsToUpdate) {
for (Conductor *conductor: content_to_move.conductorsToUpdate) {
setupAnimation(conductor, "animPath", 1, 1);
}
}
@@ -403,7 +403,7 @@ MoveConductorsTextsCommand::~MoveConductorsTextsCommand() {
/// annule le deplacement
void MoveConductorsTextsCommand::undo() {
diagram -> showMe();
foreach(ConductorTextItem *cti, texts_to_move_.keys()) {
for (ConductorTextItem *cti: texts_to_move_.keys()) {
QPointF movement = texts_to_move_[cti].first;
bool was_already_moved = texts_to_move_[cti].second;
@@ -420,7 +420,7 @@ void MoveConductorsTextsCommand::redo() {
if (first_redo) {
first_redo = false;
} else {
foreach(ConductorTextItem *cti, texts_to_move_.keys()) {
for (ConductorTextItem *cti: texts_to_move_.keys()) {
QPointF movement = texts_to_move_[cti].first;
cti -> forceMovedByUser(true);
@@ -539,10 +539,10 @@ RotateElementsCommand::~RotateElementsCommand() {
/// defait le pivotement
void RotateElementsCommand::undo() {
diagram -> showMe();
foreach(Element *e, elements_to_rotate) {
for (Element *e: elements_to_rotate) {
e -> rotateBy(-applied_rotation_angle_);
}
foreach(DiagramTextItem *dti, texts_to_rotate) {
for (DiagramTextItem *dti: texts_to_rotate) {
//ConductorTextItem have a default rotation angle, we apply a specific treatment
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(dti)) {
cti -> forceRotateByUser(previous_rotate_by_user_[cti]);
@@ -551,16 +551,16 @@ void RotateElementsCommand::undo() {
}
else {dti -> rotateBy(-applied_rotation_angle_);}
}
foreach(DiagramImageItem *dii, images_to_rotate) dii -> rotateBy(-applied_rotation_angle_);
for (DiagramImageItem *dii: images_to_rotate) dii -> rotateBy(-applied_rotation_angle_);
}
/// refait le pivotement
void RotateElementsCommand::redo() {
diagram -> showMe();
foreach(Element *e, elements_to_rotate) {
for (Element *e: elements_to_rotate) {
e -> rotateBy(applied_rotation_angle_);
}
foreach(DiagramTextItem *dti, texts_to_rotate) {
for (DiagramTextItem *dti: texts_to_rotate) {
//we grab the previous rotation by user of each ConductorTextItem
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(dti)) {
previous_rotate_by_user_.insert(cti, cti -> wasRotateByUser());
@@ -568,7 +568,7 @@ void RotateElementsCommand::redo() {
}
dti -> rotateBy(applied_rotation_angle_);
}
foreach(DiagramImageItem *dii, images_to_rotate) dii -> rotateBy(applied_rotation_angle_);
for (DiagramImageItem *dii: images_to_rotate) dii -> rotateBy(applied_rotation_angle_);
}
/**
@@ -597,7 +597,7 @@ RotateTextsCommand::RotateTextsCommand(const QList<DiagramTextItem *> &texts, do
applied_rotation_angle_(applied_rotation),
diagram(texts.first()->diagram())
{
foreach(DiagramTextItem *text, texts) {
for (DiagramTextItem *text: texts) {
texts_to_rotate.insert(text, text -> rotationAngle());
}
defineCommandName();
@@ -614,7 +614,7 @@ RotateTextsCommand::~RotateTextsCommand() {
*/
void RotateTextsCommand::undo() {
diagram -> showMe();
foreach(DiagramTextItem *text, texts_to_rotate.keys()) {
for (DiagramTextItem *text: texts_to_rotate.keys()) {
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text))
cti -> forceRotateByUser(previous_rotate_by_user_[cti]);
text -> setRotationAngle(texts_to_rotate[text]);
@@ -626,7 +626,7 @@ void RotateTextsCommand::undo() {
*/
void RotateTextsCommand::redo() {
diagram -> showMe();
foreach(DiagramTextItem *text, texts_to_rotate.keys()) {
for (DiagramTextItem *text: texts_to_rotate.keys()) {
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(text)) {
//we grab the previous rotation by user of each ConductorTextItem
previous_rotate_by_user_.insert(cti, cti -> wasRotateByUser());
@@ -741,7 +741,7 @@ ResetConductorCommand::~ResetConductorCommand() {
*/
void ResetConductorCommand::undo() {
diagram -> showMe();
foreach(Conductor *c, conductors_profiles.keys()) {
for (Conductor *c: conductors_profiles.keys()) {
c -> setProfiles(conductors_profiles[c]);
}
}
@@ -751,7 +751,7 @@ void ResetConductorCommand::undo() {
*/
void ResetConductorCommand::redo() {
diagram -> showMe();
foreach(Conductor *c, conductors_profiles.keys()) {
for (Conductor *c: conductors_profiles.keys()) {
c -> textItem() -> forceMovedByUser (false);
c -> textItem() -> forceRotateByUser (false);
c -> setProfiles(ConductorProfilesGroup());

View File

@@ -60,7 +60,7 @@ QList<Conductor *> DiagramContent::conductors(int filter) const {
if (filter & ConductorsToUpdate) result += conductorsToUpdate;
if (filter & OtherConductors) result += otherConductors;
if (filter & SelectedOnly) {
foreach(Conductor *conductor, result) {
for (Conductor *conductor: result) {
if (!conductor -> isSelected()) result.remove(conductor);
}
}
@@ -89,19 +89,19 @@ int DiagramContent::removeNonMovableItems()
{
int count_ = 0;
foreach(Element *elmt, elements) {
for (Element *elmt: elements) {
if (!elmt->isMovable()) {
elements.remove(elmt);
++count_;
}
}
foreach(DiagramImageItem *img, images) {
for (DiagramImageItem *img: images) {
if (!img->isMovable()) {
images.remove(img);
++count_;
}
}
foreach (QetShapeItem *shape, shapes) {
for (QetShapeItem *shape: shapes) {
if (!shape->isMovable()) {
shapes.remove(shape);
++count_;
@@ -116,7 +116,7 @@ int DiagramContent::removeNonMovableItems()
*/
QList<QGraphicsItem *> DiagramContent::items(int filter) const {
QList<QGraphicsItem *> items_list;
foreach(QGraphicsItem *qgi, conductors(filter)) items_list << qgi;
for (QGraphicsItem *qgi: conductors(filter)) items_list << qgi;
if (filter & Elements) foreach(QGraphicsItem *qgi, elements) items_list << qgi;
if (filter & TextFields) foreach(QGraphicsItem *qgi, textFields) items_list << qgi;
@@ -124,7 +124,7 @@ QList<QGraphicsItem *> DiagramContent::items(int filter) const {
if (filter & Shapes) foreach(QGraphicsItem *qgi, shapes) items_list << qgi;
if (filter & SelectedOnly) {
foreach(QGraphicsItem *qgi, items_list) {
for (QGraphicsItem *qgi: items_list) {
if (!qgi -> isSelected()) items_list.removeOne(qgi);
}
}

View File

@@ -110,7 +110,7 @@ bool DiagramContext::operator!=(const DiagramContext &dc) const {
named \a tag_name (defaults to "property").
*/
void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const {
foreach (QString key, keys()) {
for (QString key : keys()) {
QDomElement property = e.ownerDocument().createElement(tag_name);
property.setAttribute("name", key);
property.setAttribute("show",content_show[key]);
@@ -125,7 +125,7 @@ void DiagramContext::toXml(QDomElement &e, const QString &tag_name) const {
\a tag_name (defaults to "property").
*/
void DiagramContext::fromXml(const QDomElement &e, const QString &tag_name) {
foreach (QDomElement property, QET::findInDomElement(e, tag_name)) {
for (QDomElement property : QET::findInDomElement(e, tag_name)) {
if (!property.hasAttribute("name")) continue;
addValue(property.attribute("name"), QVariant(property.text()));
content_show.insert(property.attribute("name"), property.attribute("show", "1").toInt());
@@ -139,7 +139,7 @@ void DiagramContext::fromXml(const QDomElement &e, const QString &tag_name) {
void DiagramContext::toSettings(QSettings &settings, const QString &array_name) const {
settings.beginWriteArray(array_name);
int i = 0;
foreach (QString key, content_.keys()) {
for (QString key : content_.keys()) {
settings.setArrayIndex(i);
settings.setValue("name", key);
settings.setValue("value", content_[key].toString());

View File

@@ -70,7 +70,7 @@ DiagramContext DiagramContextWidget::context() const {
void DiagramContextWidget::setContext(const DiagramContext &context) {
clear();
int i = 0;
foreach (QString key, context.keys(DiagramContext::Alphabetical)) {
for (QString key: context.keys(DiagramContext::Alphabetical)) {
table_ -> setItem(i, 0, new QTableWidgetItem(key));
table_ -> setItem(i, 1, new QTableWidgetItem(context[key].toString()));
++ i;

View File

@@ -59,7 +59,7 @@ DiagramEventAddElement::DiagramEventAddElement(ElementsLocation &location, Diagr
DiagramEventAddElement::~DiagramEventAddElement()
{
if (m_element) delete m_element;
foreach(QGraphicsView *view, m_diagram->views())
for (QGraphicsView *view: m_diagram->views())
view -> setContextMenuPolicy(Qt::DefaultContextMenu);
}
@@ -159,7 +159,7 @@ bool DiagramEventAddElement::keyPressEvent(QKeyEvent *event)
*/
void DiagramEventAddElement::init()
{
foreach(QGraphicsView *view, m_diagram->views())
for (QGraphicsView *view: m_diagram->views())
view->setContextMenuPolicy(Qt::NoContextMenu);
}

View File

@@ -45,7 +45,7 @@ DiagramEventAddImage::~DiagramEventAddImage()
delete m_image;
}
foreach (QGraphicsView *view, m_diagram->views())
for (QGraphicsView *view: m_diagram->views())
view->setContextMenuPolicy((Qt::DefaultContextMenu));
}
@@ -64,7 +64,7 @@ bool DiagramEventAddImage::mousePressEvent(QGraphicsSceneMouseEvent *event)
pos.ry() -= m_image->boundingRect().height()/2;
m_diagram -> undoStack().push (new AddItemCommand<DiagramImageItem *>(m_image, m_diagram, pos));
foreach (QGraphicsView *view, m_diagram->views())
for (QGraphicsView *view: m_diagram->views())
view->setContextMenuPolicy((Qt::DefaultContextMenu));
m_running = false;
@@ -95,7 +95,7 @@ bool DiagramEventAddImage::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (!m_is_added)
{
foreach (QGraphicsView *view, m_diagram->views())
for (QGraphicsView *view: m_diagram->views())
view->setContextMenuPolicy((Qt::NoContextMenu));
m_diagram -> addItem(m_image);

View File

@@ -49,7 +49,7 @@ DiagramEventAddShape::~DiagramEventAddShape()
delete m_help_horiz;
delete m_help_verti;
foreach (QGraphicsView *v, m_diagram->views())
for (QGraphicsView *v: m_diagram->views())
v->setContextMenuPolicy(Qt::DefaultContextMenu);
}
@@ -191,7 +191,7 @@ bool DiagramEventAddShape::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event
void DiagramEventAddShape::init()
{
foreach (QGraphicsView *v, m_diagram->views())
for (QGraphicsView *v: m_diagram->views())
v->setContextMenuPolicy(Qt::NoContextMenu);
}

View File

@@ -395,11 +395,11 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const Exp
// deselectionne tous les elements
QList<QGraphicsItem *> selected_elmts = diagram -> selectedItems();
foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(false);
for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(false);
// enleve le flag focusable de tous les elements concernes pour eviter toute reprise de focus par un champ de texte editable
QList<QGraphicsItem *> focusable_items;
foreach (QGraphicsItem *qgi, diagram -> items()) {
for (QGraphicsItem *qgi: diagram -> items()) {
if (qgi -> flags() & QGraphicsItem::ItemIsFocusable) {
focusable_items << qgi;
qgi -> setFlag(QGraphicsItem::ItemIsFocusable, false);
@@ -407,7 +407,7 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const Exp
}
// evite toute autre forme d'interaction
foreach (QGraphicsView *view, diagram -> views()) {
for (QGraphicsView *view: diagram -> views()) {
view -> setInteractive(false);
}
@@ -476,17 +476,17 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const Exp
}
// remet en place les interactions
foreach (QGraphicsView *view, diagram -> views()) {
for (QGraphicsView *view: diagram -> views()) {
view -> setInteractive(true);
}
// restaure les flags focusable
foreach (QGraphicsItem *qgi, focusable_items) {
for (QGraphicsItem *qgi: focusable_items) {
qgi -> setFlag(QGraphicsItem::ItemIsFocusable, true);
}
// restaure les elements selectionnes
foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(true);
for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(true);
saveReloadDiagramParameters(diagram, options, false);
}

View File

@@ -62,7 +62,7 @@ QETProject *DiagramsChooser::project() const {
*/
QList<Diagram *> DiagramsChooser::selectedDiagrams() const {
QList<Diagram *> selected_diagrams;
foreach(Diagram *diagram, project_ -> diagrams()) {
for (Diagram *diagram: project_ -> diagrams()) {
QCheckBox *check_box = diagrams_[diagram];
if (check_box && check_box -> isChecked()) {
selected_diagrams << diagram;
@@ -76,7 +76,7 @@ QList<Diagram *> DiagramsChooser::selectedDiagrams() const {
*/
QList<Diagram *> DiagramsChooser::nonSelectedDiagrams() const {
QList<Diagram *> selected_diagrams;
foreach(Diagram *diagram, diagrams_.keys()) {
for (Diagram *diagram: diagrams_.keys()) {
if (!(diagrams_[diagram] -> isChecked())) {
selected_diagrams << diagram;
}
@@ -107,14 +107,14 @@ void DiagramsChooser::setSelectedDiagrams(const QList<Diagram *> &diagrams_list,
// deselectionne tous les schemas si demande
if (reset) {
foreach(QCheckBox *check_box, diagrams_.values()) {
for (QCheckBox *check_box: diagrams_.values()) {
check_box -> setChecked(false);
}
}
int changes = 0;
QCheckBox *check_box;
foreach(Diagram *diagram, diagrams_list) {
for (Diagram *diagram: diagrams_list) {
if ((check_box = diagrams_[diagram])) {
if (check_box -> isChecked() != select) {
check_box -> setChecked(select);
@@ -136,7 +136,7 @@ void DiagramsChooser::setSelectedDiagrams(const QList<Diagram *> &diagrams_list,
*/
void DiagramsChooser::setSelectedAllDiagrams(bool select) {
blockSignals(true);
foreach(QCheckBox *check_box, diagrams_.values()) {
for (QCheckBox *check_box: diagrams_.values()) {
check_box -> setChecked(select);
}
blockSignals(false);
@@ -159,7 +159,7 @@ void DiagramsChooser::updateList() {
buildLayout();
// recree les checkbox necessaires
foreach(Diagram *diagram, project_ -> diagrams()) {
for (Diagram *diagram: project_ -> diagrams()) {
// titre du schema
QString diagram_title = diagram -> title();
if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre");

View File

@@ -149,7 +149,7 @@ void DiagramView::rotateSelection() {
QList<Element *> elements_to_rotate;
QList<DiagramTextItem *> texts_to_rotate;
QList<DiagramImageItem *> images_to_rotate;
foreach (QGraphicsItem *item, scene -> selectedItems()) {
for (QGraphicsItem *item: scene -> selectedItems()) {
if (Element *e = qgraphicsitem_cast<Element *>(item)) {
elements_to_rotate << e;
} else if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
@@ -176,7 +176,7 @@ void DiagramView::rotateTexts() {
// recupere les champs de texte a orienter
QList<DiagramTextItem *> texts_to_rotate;
foreach (QGraphicsItem *item, scene -> selectedItems()) {
for (QGraphicsItem *item: scene -> selectedItems()) {
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
texts_to_rotate << cti;
} else if (IndependentTextItem *iti = qgraphicsitem_cast<IndependentTextItem *>(item)) {
@@ -714,7 +714,7 @@ void DiagramView::keyReleaseEvent(QKeyEvent *e) {
void DiagramView::scrollOnMovement(QKeyEvent *e){
QList<QGraphicsItem *> selected_elmts = scene->selectedContent().items(255);
QRectF viewed_scene = viewedSceneRect();
foreach (QGraphicsItem *qgi, selected_elmts){
for (QGraphicsItem *qgi: selected_elmts){
if (qgraphicsitem_cast<Conductor *>(qgi)) continue;
if (qgraphicsitem_cast<QetShapeItem *>(qgi)) continue;
qreal x = qgi->pos().x();
@@ -802,7 +802,7 @@ bool DiagramView::hasSelectedItems() {
peuvent etre copies dans le presse-papier, false sinon
*/
bool DiagramView::hasCopiableItems() {
foreach(QGraphicsItem *qgi, scene -> selectedItems()) {
for (QGraphicsItem *qgi: scene -> selectedItems()) {
if (
qgraphicsitem_cast<Element *>(qgi) ||
qgraphicsitem_cast<IndependentTextItem *>(qgi) ||
@@ -819,7 +819,7 @@ bool DiagramView::hasCopiableItems() {
@return true if there is any Text Item selected
*/
bool DiagramView::hasTextItems() {
foreach(QGraphicsItem *qgi, scene -> selectedItems()) {
for (QGraphicsItem *qgi: scene -> selectedItems()) {
if (
qgraphicsitem_cast<IndependentTextItem *>(qgi) ||
qgraphicsitem_cast<ElementTextItem *>(qgi) ||
@@ -837,7 +837,7 @@ bool DiagramView::hasTextItems() {
peuvent etre supprimes, false sinon
*/
bool DiagramView::hasDeletableItems() {
foreach(QGraphicsItem *qgi, scene -> selectedItems()) {
for (QGraphicsItem *qgi: scene -> selectedItems()) {
if (
qgraphicsitem_cast<Element *>(qgi) ||
qgraphicsitem_cast<Conductor *>(qgi) ||
@@ -1068,7 +1068,7 @@ void DiagramView::resetConductors() {
// repere les conducteurs modifies (= profil non nul)
QHash<Conductor *, ConductorProfilesGroup> conductors_and_profiles;
foreach(Conductor *conductor, selected_conductors) {
for (Conductor *conductor: selected_conductors) {
ConductorProfilesGroup profile = conductor -> profiles();
if (
!profile[Qt::TopLeftCorner].isNull() ||\

View File

@@ -89,14 +89,14 @@ DeletePartsCommand::DeletePartsCommand(
ElementEditionCommand(QObject::tr("suppression", "undo caption"), scene, 0, parent),
deleted_parts(parts)
{
foreach(QGraphicsItem *qgi, deleted_parts) {
for (QGraphicsItem *qgi: deleted_parts) {
editor_scene_ -> qgiManager().manage(qgi);
}
}
/// Destructeur : detruit egalement les parties supprimees
DeletePartsCommand::~DeletePartsCommand() {
foreach(QGraphicsItem *qgi, deleted_parts) {
for (QGraphicsItem *qgi: deleted_parts) {
editor_scene_ -> qgiManager().release(qgi);
}
}
@@ -104,7 +104,7 @@ DeletePartsCommand::~DeletePartsCommand() {
/// Restaure les parties supprimees
void DeletePartsCommand::undo() {
editor_scene_ -> blockSignals(true);
foreach(QGraphicsItem *qgi, deleted_parts) {
for (QGraphicsItem *qgi: deleted_parts) {
editor_scene_ -> addItem(qgi);
}
editor_scene_ -> blockSignals(false);
@@ -113,7 +113,7 @@ void DeletePartsCommand::undo() {
/// Supprime les parties
void DeletePartsCommand::redo() {
editor_scene_ -> blockSignals(true);
foreach(QGraphicsItem *qgi, deleted_parts) {
for (QGraphicsItem *qgi: deleted_parts) {
editor_scene_ -> removeItem(qgi);
}
editor_scene_ -> blockSignals(false);
@@ -149,7 +149,7 @@ PastePartsCommand::~PastePartsCommand() {
void PastePartsCommand::undo() {
// enleve les parties
editor_scene_ -> blockSignals(true);
foreach(QGraphicsItem *part, content_) {
for (QGraphicsItem *part: content_) {
editor_scene_ -> removeItem(part);
}
editor_scene_ -> blockSignals(false);
@@ -166,7 +166,7 @@ void PastePartsCommand::redo() {
else {
// pose les parties
editor_scene_ -> blockSignals(true);
foreach(QGraphicsItem *part, content_) {
for (QGraphicsItem *part: content_) {
editor_scene_ -> addItem(part);
}
editor_scene_ -> blockSignals(false);
@@ -240,7 +240,7 @@ MovePartsCommand::~MovePartsCommand() {
/// Annule le deplacement
void MovePartsCommand::undo() {
foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(-movement.x(), -movement.y());
for (QGraphicsItem *qgi: moved_parts) qgi -> moveBy(-movement.x(), -movement.y());
}
/// Refait le deplacement
@@ -250,7 +250,7 @@ void MovePartsCommand::redo() {
first_redo = false;
return;
}
foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(movement.x(), movement.y());
for (QGraphicsItem *qgi: moved_parts) qgi -> moveBy(movement.x(), movement.y());
}
/*** AddPartCommand ***/
@@ -353,7 +353,7 @@ ChangeZValueCommand::ChangeZValueCommand(
QList<QGraphicsItem *> items_list = editor_scene_ -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot);
// prend un snapshot des zValues
foreach(QGraphicsItem *qgi, items_list) undo_hash.insert(qgi, qgi -> zValue());
for (QGraphicsItem *qgi: items_list) undo_hash.insert(qgi, qgi -> zValue());
// choisit le nom en fonction du traitement
if (option == BringForward) {
@@ -377,12 +377,12 @@ ChangeZValueCommand::~ChangeZValueCommand() {
/// Annule les changements de zValue
void ChangeZValueCommand::undo() {
foreach(QGraphicsItem *qgi, undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]);
for (QGraphicsItem *qgi: undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]);
}
/// Refait les changements de zValue
void ChangeZValueCommand::redo() {
foreach(QGraphicsItem *qgi, redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]);
for (QGraphicsItem *qgi: redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]);
}
/**
@@ -392,15 +392,15 @@ void ChangeZValueCommand::redo() {
void ChangeZValueCommand::applyBringForward(const QList<QGraphicsItem *> &items_list) {
QList<QGraphicsItem *> non_selected_items = items_list;
QList<QGraphicsItem *> selected_items;
foreach(QGraphicsItem *qgi, non_selected_items) {
for (QGraphicsItem *qgi: non_selected_items) {
if (qgi -> isSelected()) {
selected_items << qgi;
non_selected_items.removeAt(non_selected_items.indexOf(qgi));
}
}
int z = 1;
foreach(QGraphicsItem *qgi, non_selected_items) redo_hash.insert(qgi, z ++);
foreach(QGraphicsItem *qgi, selected_items) redo_hash.insert(qgi, z ++);
for (QGraphicsItem *qgi: non_selected_items) redo_hash.insert(qgi, z ++);
for (QGraphicsItem *qgi: selected_items) redo_hash.insert(qgi, z ++);
}
/**
@@ -418,7 +418,7 @@ void ChangeZValueCommand::applyRaise(const QList<QGraphicsItem *> &items_list) {
}
}
int z = 1;
foreach(QGraphicsItem *qgi, my_items_list) redo_hash.insert(qgi, z ++);
for (QGraphicsItem *qgi: my_items_list) redo_hash.insert(qgi, z ++);
}
/**
@@ -437,7 +437,7 @@ void ChangeZValueCommand::applyLower(const QList<QGraphicsItem *> &items_list) {
}
int z = 1;
foreach(QGraphicsItem *qgi, my_items_list) redo_hash.insert(qgi, z ++);
for (QGraphicsItem *qgi: my_items_list) redo_hash.insert(qgi, z ++);
}
/**
@@ -447,15 +447,15 @@ void ChangeZValueCommand::applyLower(const QList<QGraphicsItem *> &items_list) {
void ChangeZValueCommand::applySendBackward(const QList<QGraphicsItem *> &items_list) {
QList<QGraphicsItem *> non_selected_items = items_list;
QList<QGraphicsItem *> selected_items;
foreach(QGraphicsItem *qgi, non_selected_items) {
for (QGraphicsItem *qgi: non_selected_items) {
if (qgi -> isSelected()) {
selected_items << qgi;
non_selected_items.removeAt(non_selected_items.indexOf(qgi));
}
}
int z = 1;
foreach(QGraphicsItem *qgi, selected_items) redo_hash.insert(qgi, z ++);
foreach(QGraphicsItem *qgi, non_selected_items) redo_hash.insert(qgi, z ++);
for (QGraphicsItem *qgi: selected_items) redo_hash.insert(qgi, z ++);
for (QGraphicsItem *qgi: non_selected_items) redo_hash.insert(qgi, z ++);
}
/**
@@ -569,7 +569,7 @@ void ScalePartsCommand::scale(const QRectF &before, const QRectF &after) {
if (before == after) return;
if (!before.width() || !before.height()) return; // cowardly flee division by zero FIXME?
foreach (CustomElementPart *part_item, scaled_primitives_) {
for (CustomElementPart *part_item: scaled_primitives_) {
part_item -> startUserTransformation(before);
part_item -> handleUserTransformation(before, after);
}

View File

@@ -58,7 +58,7 @@ QRectF ElementPrimitiveDecorator::internalBoundingRect() const {
}
}
QRectF rect = decorated_items_.first() -> sceneGeometricRect();
foreach (CustomElementPart *item, decorated_items_) {
for (CustomElementPart *item: decorated_items_) {
rect = rect.united(item -> sceneGeometricRect());
}
return(rect);
@@ -146,7 +146,7 @@ void ElementPrimitiveDecorator::setItems(const QList<CustomElementPart *> &items
*/
void ElementPrimitiveDecorator::setItems(const QList<QGraphicsItem *> &items) {
QList<CustomElementPart *> primitives;
foreach (QGraphicsItem *item, items) {
for (QGraphicsItem *item: items) {
if (CustomElementPart *part_item = dynamic_cast<CustomElementPart *>(item)) {
primitives << part_item;
}
@@ -166,7 +166,7 @@ QList<CustomElementPart *> ElementPrimitiveDecorator::items() const {
*/
QList<QGraphicsItem *> ElementPrimitiveDecorator::graphicsItems() const {
QList<QGraphicsItem *> list;
foreach (CustomElementPart *part_item, decorated_items_) {
for (CustomElementPart *part_item: decorated_items_) {
if (QGraphicsItem *item = dynamic_cast<QGraphicsItem *>(part_item)) {
list << item;
}
@@ -410,7 +410,7 @@ void ElementPrimitiveDecorator::keyPressEvent(QKeyEvent *e) {
} else {
keys_movement_ += movement;
}
foreach(QGraphicsItem *qgi, graphicsItems()) {
for (QGraphicsItem *qgi: graphicsItems()) {
qgi -> setPos(qgi -> pos() + movement);
adjust();
}
@@ -469,7 +469,7 @@ void ElementPrimitiveDecorator::adjustEffectiveBoundingRect() {
void ElementPrimitiveDecorator::startMovement() {
adjust();
foreach(CustomElementPart *item, decorated_items_) {
for (CustomElementPart *item: decorated_items_) {
item -> startUserTransformation(mapToScene(original_bounding_rect_).boundingRect());
}
}
@@ -533,7 +533,7 @@ CustomElementPart *ElementPrimitiveDecorator::singleItem() const {
void ElementPrimitiveDecorator::translateItems(const QPointF &movement) {
if (!decorated_items_.count()) return;
foreach(QGraphicsItem *qgi, graphicsItems()) {
for (QGraphicsItem *qgi: graphicsItems()) {
// this is a naive, proof-of-concept implementation; we actually need to take
// the grid into account and create a command object in mouseReleaseEvent()
qgi -> moveBy(movement.x(), movement.y());
@@ -553,7 +553,7 @@ void ElementPrimitiveDecorator::scaleItems(const QRectF &original_rect, const QR
QRectF scene_original_rect = mapToScene(original_rect).boundingRect();
QRectF scene_new_rect = mapToScene(new_rect).boundingRect();
foreach(CustomElementPart *item, decorated_items_) {
for (CustomElementPart *item: decorated_items_) {
item -> handleUserTransformation(scene_original_rect, scene_new_rect);
}
}

View File

@@ -332,7 +332,7 @@ const QDomDocument ElementScene::toXml(bool all_parts)
QDomElement description = xml_document.createElement("description");
//the graphic description of the element
foreach(QGraphicsItem *qgi, zItems())
for (QGraphicsItem *qgi: zItems())
{
//If the export concerns only the selection, the not selected part is ignored
if (!all_parts && !qgi -> isSelected()) continue;
@@ -416,7 +416,7 @@ void ElementScene::fromXml(
*/
QRectF ElementScene::elementSceneGeometricRect() const{
QRectF esgr;
foreach (QGraphicsItem *qgi, items()) {
for (QGraphicsItem *qgi: items()) {
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
if (qgi -> type() == QGraphicsRectItem::Type) continue;
if (qgi -> type() == PartTextField::Type) continue;
@@ -432,7 +432,7 @@ QRectF ElementScene::elementSceneGeometricRect() const{
aucune.
*/
bool ElementScene::containsTerminals() const {
foreach(QGraphicsItem *qgi,items()) {
for (QGraphicsItem *qgi:items()) {
if (qgraphicsitem_cast<PartTerminal *>(qgi)) {
return(true);
}
@@ -515,7 +515,7 @@ QETElementEditor* ElementScene::editor() const {
void ElementScene::slot_select(const ElementContent &content) {
blockSignals(true);
clearSelection();
foreach(QGraphicsItem *qgi, content) qgi -> setSelected(true);
for (QGraphicsItem *qgi: content) qgi -> setSelected(true);
blockSignals(false);
emit(selectionChanged());
}
@@ -539,7 +539,7 @@ void ElementScene::slot_deselectAll() {
*/
void ElementScene::slot_invertSelection() {
blockSignals(true);
foreach(QGraphicsItem *qgi, items()) qgi -> setSelected(!qgi -> isSelected());
for (QGraphicsItem *qgi: items()) qgi -> setSelected(!qgi -> isSelected());
blockSignals(false);
emit(selectionChanged());
}
@@ -698,7 +698,7 @@ void ElementScene::slot_sendBackward() {
*/
QList<CustomElementPart *> ElementScene::primitives() const {
QList<CustomElementPart *> primitives_list;
foreach (QGraphicsItem *item, items()) {
for (QGraphicsItem *item: items()) {
if (CustomElementPart *primitive = dynamic_cast<CustomElementPart *>(item)) {
primitives_list << primitive;
}
@@ -768,7 +768,7 @@ QList<QGraphicsItem *> ElementScene::zItems(ItemOptions options) const {
*/
ElementContent ElementScene::selectedContent() const {
ElementContent content;
foreach(QGraphicsItem *qgi, zItems()) {
for (QGraphicsItem *qgi: zItems()) {
if (qgi -> isSelected()) content << qgi;
}
return(content);
@@ -796,7 +796,7 @@ void ElementScene::reset()
clearSelection();
undoStack().clear();
foreach (QGraphicsItem *qgi, items())
for (QGraphicsItem *qgi: items())
{
removeItem(qgi);
qgiManager().release(qgi);
@@ -813,7 +813,7 @@ void ElementScene::reset()
*/
QRectF ElementScene::elementContentBoundingRect(const ElementContent &content) const {
QRectF bounding_rect;
foreach(QGraphicsItem *qgi, content) {
for (QGraphicsItem *qgi: content) {
// skip non-primitives QGraphicsItems (paste area, selection decorator)
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
if (qgi -> type() == QGraphicsRectItem::Type) continue;
@@ -924,7 +924,7 @@ ElementContent ElementScene::loadContent(const QDomDocument &xml_document, QStri
*/
ElementContent ElementScene::addContent(const ElementContent &content, QString *error_message) {
Q_UNUSED(error_message);
foreach(QGraphicsItem *part, content) {
for (QGraphicsItem *part: content) {
addPrimitive(part);
}
return(content);
@@ -947,7 +947,7 @@ ElementContent ElementScene::addContentAtPos(const ElementContent &content, cons
QPointF offset = pos - bounding_rect.topLeft();
// ajoute les parties avec le decalage adequat
foreach(QGraphicsItem *part, content) {
for (QGraphicsItem *part: content) {
part -> setPos(part -> pos() + offset);
addPrimitive(part);
}
@@ -1018,7 +1018,7 @@ void ElementScene::centerElementToOrigine() {
if (center_y < 0) move_y -= 10;
//move each primitive by @move
foreach (QGraphicsItem *qgi, items()) {
for (QGraphicsItem *qgi: items()) {
if (qgi -> type() == ElementPrimitiveDecorator::Type) continue;
if (qgi -> type() == QGraphicsRectItem::Type) continue;
//deselect item for disable decorator
@@ -1075,7 +1075,7 @@ void ElementScene::stackAction(ElementEditionCommand *command) {
}
if (!command -> elementView()) {
foreach (QGraphicsView *view, views()) {
for (QGraphicsView *view: views()) {
if (ElementView *element_view = dynamic_cast<ElementView *>(view)) {
command -> setElementView(element_view);
break;

View File

@@ -219,7 +219,7 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
//Check each pair of style
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
foreach (QString style, styles)
for (QString style: styles)
{
if (!rx.exactMatch(style)) continue;
QString style_name = rx.cap(1);

View File

@@ -129,7 +129,7 @@ QList<QPointF> CustomElementPart::mapPoints(const QRectF &initial_selection_rect
qreal new_top_left_x = new_selection_rect.x();
qreal new_top_left_y = new_selection_rect.y();
foreach (QPointF point, points) {
for (QPointF point: points) {
QPointF point_offset = point - initial_top_left;
new_points << QPointF(
new_top_left_x + (point_offset.rx() * sx),

View File

@@ -133,7 +133,7 @@ QRectF PartArc::boundingRect() const
{
QRectF r = AbstractPartEllipse::boundingRect();
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
r |= rect;
return r;
@@ -154,7 +154,7 @@ QPainterPath PartArc::shape() const
shape = pps.createStroke(shape);
if (isSelected())
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
shape.addRect(rect);
return shape;

View File

@@ -129,7 +129,7 @@ QRectF PartEllipse::boundingRect() const
{
QRectF r = AbstractPartEllipse::boundingRect();
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
r |= rect;
return r;
@@ -149,7 +149,7 @@ QPainterPath PartEllipse::shape() const
shape = pps.createStroke(shape);
if (isSelected())
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
shape.addRect(rect);
return shape;

View File

@@ -244,7 +244,7 @@ QPainterPath PartLine::shape() const
shape = pps.createStroke(shape);
if (isSelected())
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForLine(m_line)))
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForLine(m_line)))
shape.addRect(rect);
return shape;
@@ -373,10 +373,10 @@ void PartLine::debugPaint(QPainter *painter)
painter -> setPen(Qt::red);
foreach(QPointF pointy, fourEndPoints(m_line.p1(), m_line.p2(), first_length))
for (QPointF pointy: fourEndPoints(m_line.p1(), m_line.p2(), first_length))
painter -> drawEllipse(pointy, 0.1, 0.1);
foreach(QPointF pointy, fourEndPoints(m_line.p2(), m_line.p1(), second_length))
for (QPointF pointy: fourEndPoints(m_line.p2(), m_line.p1(), second_length))
painter -> drawEllipse(pointy, 0.1, 0.1);
painter -> restore();
@@ -402,7 +402,7 @@ QRectF PartLine::boundingRect() const
bound = bound.normalized();
bound.adjust(-adjust, -adjust, adjust, adjust);
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForLine(m_line)))
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForLine(m_line)))
bound |= rect;
return bound;

View File

@@ -109,7 +109,7 @@ const QDomElement PartPolygon::toXml(QDomDocument &xml_document) const
{
QDomElement xml_element = xml_document.createElement("polygon");
int i = 1;
foreach(QPointF point, m_polygon) {
for (QPointF point: m_polygon) {
point = mapToScene(point);
xml_element.setAttribute(QString("x%1").arg(i), QString("%1").arg(point.x()));
xml_element.setAttribute(QString("y%1").arg(i), QString("%1").arg(point.y()));
@@ -344,7 +344,7 @@ QPainterPath PartPolygon::shape() const
shape = pps.createStroke(shape);
if (isSelected())
foreach(QRectF rect, m_handler.handlerRect(m_polygon))
for (QRectF rect: m_handler.handlerRect(m_polygon))
shape.addRect(rect);
return shape;
@@ -379,7 +379,7 @@ QRectF PartPolygon::boundingRect() const
r.adjust(-adjust, -adjust, adjust, adjust);
foreach(QRectF rect, m_handler.handlerRect(m_polygon))
for (QRectF rect: m_handler.handlerRect(m_polygon))
r |=rect;
return(r);

View File

@@ -165,7 +165,7 @@ QPainterPath PartRectangle::shape() const
shape = pps.createStroke(shape);
if (isSelected())
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
shape.addRect(rect);
return shape;
@@ -196,7 +196,7 @@ QRectF PartRectangle::boundingRect() const
QRectF r = m_rect.normalized();
r.adjust(-adjust, -adjust, adjust, adjust);
foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect)))
r |= rect;
return(r);

View File

@@ -101,7 +101,7 @@ void PolygonEditor::updateForm() {
if (!part) return;
activeConnections(false);
while(points_list.takeTopLevelItem(0)) {}
foreach(QPointF point, part -> polygon()) {
for (QPointF point: part -> polygon()) {
point = part -> mapToScene(point);
QStringList qsl;
qsl << QString("%1").arg(point.x()) << QString("%1").arg(point.y());

View File

@@ -276,7 +276,7 @@ void QETElementEditor::setupActions() {
QAction *add_terminal = new QAction(QET::Icons::Terminal, tr("Ajouter une borne"), parts);
QAction *add_textfield = new QAction(QET::Icons::PartTextField, tr("Ajouter un champ de texte"), parts);
foreach (QAction *action, parts -> actions()) action -> setCheckable(true);
for (QAction *action: parts -> actions()) action -> setCheckable(true);
connect(add_line, SIGNAL(triggered()), this, SLOT(addLine() ));
connect(add_rectangle, SIGNAL(triggered()), this, SLOT(addRect() ));
@@ -433,7 +433,7 @@ void QETElementEditor::slot_updateMenus() {
bool clipboard_elmt = !read_only && ElementScene::clipboardMayContainElement();
// actions dependant seulement de l'etat "lecture seule" de l'editeur
foreach (QAction *action, parts -> actions()) {
for (QAction *action: parts -> actions()) {
action -> setEnabled(!read_only);
}
selectall -> setEnabled(!read_only);
@@ -447,7 +447,7 @@ void QETElementEditor::slot_updateMenus() {
cut -> setEnabled(selected_items);
copy -> setEnabled(selected_items);
edit_delete -> setEnabled(selected_items);
foreach (QAction *action, m_depth_ag -> actions())
for (QAction *action: m_depth_ag -> actions())
action->setEnabled(selected_items);
// actions dependant du contenu du presse-papiers
@@ -579,7 +579,7 @@ void QETElementEditor::slot_updateInformations() {
if (selected_qgis.size() >= 2)
{
style_editable = true;
foreach (QGraphicsItem *qgi, selected_qgis)
for (QGraphicsItem *qgi: selected_qgis)
{
if (CustomElementPart *cep = dynamic_cast<CustomElementPart *>(qgi))
cep_list << cep;
@@ -689,7 +689,7 @@ bool QETElementEditor::checkElement()
{
bool wrng = true;
foreach (CustomElementPart *cep, ce_scene->primitives())
for (CustomElementPart *cep: ce_scene->primitives())
if (cep->property("tagg").toString() == "label") wrng = false;
///Error #1: element is master, slave or simple but havent got input tagged 'label'
@@ -708,7 +708,7 @@ bool QETElementEditor::checkElement()
{
int text =0, terminal =0;
foreach(QGraphicsItem *qgi, ce_scene->items())
for (QGraphicsItem *qgi: ce_scene->items())
{
if (qgraphicsitem_cast<PartTerminal *>(qgi)) terminal ++;
else if (qgraphicsitem_cast<PartTextField *>(qgi)) text ++;
@@ -744,7 +744,7 @@ bool QETElementEditor::checkElement()
dialog_message += "<ol>";
QList<QETWarning> total = warnings << errors;
foreach(QETWarning warning, total) {
for (QETWarning warning: total) {
dialog_message += "<li>";
dialog_message += QString(
tr("<b>%1</b> : %2", "warning title: warning description")
@@ -990,7 +990,7 @@ void QETElementEditor::addTerminal() {
* Uncheck all action related to primitive
*/
void QETElementEditor::UncheckAddPrimitive() {
foreach(QAction *action, parts->actions()) action -> setChecked(false);
for (QAction *action: parts->actions()) action -> setChecked(false);
}
/**

View File

@@ -177,7 +177,7 @@ void StyleEditor::updateForm()
size_weight -> setCurrentIndex(first_part -> lineWeight());
filling_color -> setCurrentIndex(first_part -> filling());
foreach (CustomElementGraphicPart *cegp, m_part_list)
for (CustomElementGraphicPart *cegp: m_part_list)
{
if (first_part -> antialiased() != cegp -> antialiased()) antialiasing -> setChecked(false);
if (first_part -> color() != cegp -> color()) outline_color -> setCurrentIndex(-1);
@@ -236,7 +236,7 @@ bool StyleEditor::setParts(QList<CustomElementPart *> part_list)
if (!isStyleEditable(part_list)) return false;
foreach (CustomElementPart *cep, part_list)
for (CustomElementPart *cep: part_list)
{
if (CustomElementGraphicPart *cegp = dynamic_cast<CustomElementGraphicPart *>(cep))
m_part_list << cegp;
@@ -244,7 +244,7 @@ bool StyleEditor::setParts(QList<CustomElementPart *> part_list)
return false;
}
foreach (CustomElementGraphicPart *cegp, m_part_list)
for (CustomElementGraphicPart *cegp: m_part_list)
m_cep_list << cegp;
updateForm();
@@ -268,7 +268,7 @@ bool StyleEditor::isStyleEditable(QList<CustomElementPart *> cep_list)
QStringList str;
str << "arc" << "ellipse" << "line" << "polygon" << "rect";
foreach (CustomElementPart *cep, cep_list)
for (CustomElementPart *cep: cep_list)
if (!str.contains(cep -> xmlName()))
return false;
@@ -307,7 +307,7 @@ void StyleEditor::makeUndo(const QString &undo_text, const char *property_name,
}
else if (!m_part_list.isEmpty())
{
foreach (CustomElementGraphicPart *cegp, m_part_list)
for (CustomElementGraphicPart *cegp: m_part_list)
{
if (!undo)
{

View File

@@ -89,7 +89,7 @@ void ElementDialog::setUpWidget()
m_model = new ElementsCollectionModel(m_tree_view);
QList <QETProject *> prjs;
foreach(QETProject *prj, QETApp::registeredProjects())
for (QETProject *prj: QETApp::registeredProjects())
prjs.append(prj);
if (m_mode == OpenElement)

View File

@@ -52,11 +52,11 @@ QList <Element *> ElementProvider::freeElement(const int filter) const{
QList <Element *> free_elmt;
//serch in all diagram
foreach (Diagram *d, diag_list) {
for (Diagram *d: diag_list) {
//get all element in diagram d
QList <Element *> elmt_list;
elmt_list = d->elements();
foreach (Element *elmt, elmt_list) {
for (Element *elmt: elmt_list) {
if (filter & elmt->linkType())
if (elmt->isFree()) free_elmt << elmt;
}
@@ -72,8 +72,8 @@ QList <Element *> ElementProvider::freeElement(const int filter) const{
QList <Element *> ElementProvider::fromUuids(QList<QUuid> uuid_list) const {
QList <Element *> found_element;
foreach (Diagram *d, diag_list) {
foreach(Element *elmt, d->elements()) {
for (Diagram *d: diag_list) {
for (Element *elmt: d->elements()) {
if (uuid_list.contains(elmt->uuid())) {
found_element << elmt;
uuid_list.removeAll(elmt->uuid());
@@ -94,11 +94,11 @@ QList <Element *> ElementProvider::find(const int filter) const {
QList <Element *> elmt_;
//serch in all diagram
foreach (Diagram *d, diag_list) {
for (Diagram *d: diag_list) {
//get all element in diagram d
QList <Element *> elmt_list;
elmt_list = d->elements();
foreach (Element *elmt, elmt_list) {
for (Element *elmt: elmt_list) {
if (filter & elmt->linkType())
elmt_ << elmt;
}

View File

@@ -99,18 +99,18 @@ void ElementsMover::continueMovement(const QPointF &movement) {
//Move every movable item, except conductor
typedef DiagramContent dc;
foreach (QGraphicsItem *qgi, moved_content_.items(dc::Elements | dc::TextFields | dc::Images | dc::Shapes)) {
for (QGraphicsItem *qgi: moved_content_.items(dc::Elements | dc::TextFields | dc::Images | dc::Shapes)) {
if (qgi == movement_driver_) continue;
qgi -> setPos(qgi->pos() + movement);
}
// Move some conductors
foreach(Conductor *conductor, moved_content_.conductorsToMove) {
for (Conductor *conductor: moved_content_.conductorsToMove) {
conductor -> setPos(conductor -> pos() + movement);
}
// Recalcul the path of other conductors
foreach(Conductor *conductor, moved_content_.conductorsToUpdate) {
for (Conductor *conductor: moved_content_.conductorsToUpdate) {
conductor -> updatePath();
}
}
@@ -168,7 +168,7 @@ void ElementsMover::endMovement()
{
use_properties = true;
others_properties = (*conductors_list.begin())->properties();
foreach (Conductor *cond, conductors_list)
for (Conductor *cond: conductors_list)
if (cond->properties() != others_properties)
use_properties = false;
}

View File

@@ -238,7 +238,7 @@ void ElementsPanel::reload(bool reload_collections) {
if (first_reload_) custom_tbt_collection_item_ -> setExpanded(true);
// add projects
foreach(QETProject *project, projects_to_display_.values()) {
for (QETProject *project: projects_to_display_.values()) {
addProject(project);
}
@@ -321,7 +321,7 @@ void ElementsPanel::filter(const QString &m, QET::Filtering filtering) {
const int expanded_role = 42; // magic number? So you consider Douglas Adams wrote about magic?
if (filtering == QET::BeginFilter) {
foreach (QTreeWidgetItem *item, items) {
for (QTreeWidgetItem *item: items) {
item -> setData(0, expanded_role, item -> isExpanded());
}
}
@@ -334,7 +334,7 @@ void ElementsPanel::filter(const QString &m, QET::Filtering filtering) {
QTreeWidgetItem *current_item = currentItem();
// restore the tree as it was before the filtering
foreach (QTreeWidgetItem *qtwi, items) {
for (QTreeWidgetItem *qtwi: items) {
qtwi -> setHidden(false);
qtwi -> setExpanded(qtwi -> data(0, expanded_role).toBool());
}
@@ -377,7 +377,7 @@ void ElementsPanel::buildFilterList() {
filter_list_ = filter_.split( '+' );
/*
qDebug() << "*******************";
foreach( QString filter , filter_list_ ) {
for ( QString filter , filter_list_ ) {
filter = filter.trimmed();
qDebug() << filter;
}
@@ -392,10 +392,10 @@ void ElementsPanel::applyCurrentFilter(const QList<QTreeWidgetItem *> &items) {
buildFilterList();
QList<QTreeWidgetItem *> matching_items;
foreach (QTreeWidgetItem *item, items) {
for (QTreeWidgetItem *item: items) {
bool item_matches = true;
foreach( QString filter , filter_list_ ) {
for ( QString filter : filter_list_ ) {
filter = filter.trimmed();
if ( !filter.isEmpty() ) {
item_matches &= matchesFilter(item, filter);
@@ -414,19 +414,19 @@ void ElementsPanel::applyCurrentFilter(const QList<QTreeWidgetItem *> &items) {
void ElementsPanel::ensureHierarchyIsVisible(const QList<QTreeWidgetItem *> &items) {
// remonte l'arborescence pour lister les categories contenant les elements filtres
QSet<QTreeWidgetItem *> parent_items;
foreach(QTreeWidgetItem *item, items) {
for (QTreeWidgetItem *item: items) {
for (QTreeWidgetItem *parent_qtwi = item -> parent() ; parent_qtwi ; parent_qtwi = parent_qtwi -> parent()) {
parent_items << parent_qtwi;
}
}
// etend les parents
foreach(QTreeWidgetItem *parent_qtwi, parent_items) {
for (QTreeWidgetItem *parent_qtwi: parent_items) {
if (!parent_qtwi -> isExpanded()) parent_qtwi -> setExpanded(true);
}
// affiche les parents
foreach(QTreeWidgetItem *parent_qtwi, parent_items) {
for (QTreeWidgetItem *parent_qtwi: parent_items) {
if (parent_qtwi -> isHidden()) parent_qtwi -> setHidden(false);
}
}

View File

@@ -53,7 +53,7 @@ int ElementTextsMover::beginMovement(Diagram *diagram, QGraphicsItem *driver_ite
movement_driver_ = driver_item;
m_texts_item_H.clear();
foreach(QGraphicsItem *item, diagram -> selectedItems())
for (QGraphicsItem *item: diagram -> selectedItems())
{
if (item->type() == ElementTextItem::Type)
{
@@ -79,7 +79,7 @@ void ElementTextsMover::continueMovement(const QPointF &movement)
{
if (!movement_running_ || movement.isNull()) return;
foreach(ElementTextItem *text_item, m_texts_item_H.keys())
for (ElementTextItem *text_item: m_texts_item_H.keys())
{
if (text_item == movement_driver_) continue;
QPointF applied_movement = text_item -> mapMovementToParent(text_item-> mapMovementFromScene(movement));
@@ -101,7 +101,7 @@ void ElementTextsMover::endMovement()
QPropertyUndoCommand *undo = nullptr;
foreach (ElementTextItem *eti, m_texts_item_H.keys())
for (ElementTextItem *eti: m_texts_item_H.keys())
{
if (undo)
{

View File

@@ -110,7 +110,7 @@ ExportDialog::~ExportDialog() {
*/
int ExportDialog::diagramsToExportCount() const {
int checked_diagrams_count = 0;
foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) {
for (ExportDiagramLine *diagram_line: diagram_lines_.values()) {
if (diagram_line -> must_export -> isChecked()) ++ checked_diagrams_count;
}
return(checked_diagrams_count);
@@ -143,7 +143,7 @@ QWidget *ExportDialog::initDiagramsListPart() {
diagrams_list_layout_ -> addWidget(new QLabel(tr("Dimensions")), line_count, 3, Qt::AlignHCenter | Qt::AlignVCenter);
// remplit la liste
foreach (Diagram *diagram, project_ -> diagrams()) {
for (Diagram *diagram: project_ -> diagrams()) {
++ line_count;
ExportDiagramLine *diagram_line = new ExportDiagramLine(diagram, diagramSize(diagram));
diagram_lines_.insert(line_count, diagram_line);
@@ -184,13 +184,13 @@ QWidget *ExportDialog::initDiagramsListPart() {
}
void ExportDialog::slot_selectAllClicked() {
foreach (ExportDiagramLine *diagramLine, diagram_lines_) {
for (ExportDiagramLine *diagramLine: diagram_lines_) {
diagramLine -> must_export -> setChecked(true);
}
}
void ExportDialog::slot_deSelectAllClicked() {
foreach (ExportDiagramLine *diagramLine, diagram_lines_) {
for (ExportDiagramLine *diagramLine: diagram_lines_) {
diagramLine -> must_export -> setChecked(false);
}
}
@@ -465,7 +465,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
} else {
// Determine les elements a "XMLiser"
foreach(QGraphicsItem *qgi, diagram -> items()) {
for (QGraphicsItem *qgi: diagram -> items()) {
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
list_elements << elmt;
} else if (Conductor *f = qgraphicsitem_cast<Conductor *>(qgi)) {
@@ -480,10 +480,10 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
}
}
foreach (QetShapeItem *qsi, list_shapes) qsi->toDXF(file_path);
for (QetShapeItem *qsi: list_shapes) qsi->toDXF(file_path);
//Draw elements
foreach(Element *elmt, list_elements) {
for (Element *elmt: list_elements) {
double rotation_angle = elmt -> orientation() * 90;
@@ -494,7 +494,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
qreal hotspot_y = Createdxf::sheetHeight - (elem_pos_y) * Createdxf::yScale;
QList<ElementTextItem *> elmt_text = elmt -> texts();
foreach(ElementTextItem *dti, elmt_text) {
for (ElementTextItem *dti: elmt_text) {
qreal fontSize = dti -> font().pointSizeF();
if (fontSize < 0)
fontSize = dti -> font().pixelSize();
@@ -508,7 +508,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
y = transformed_point.y();
QStringList lines = dti -> toPlainText().split('\n');
y += (fontSize/2) * (lines.count()-1);
foreach (QString line, lines) {
for (QString line: lines) {
qreal angle = 360 - (dti -> rotationAngle() + rotation_angle);
if (line.size() > 0 && line != "_" )
Createdxf::drawText(file_path, line, x, y, fontSize, angle, 0);
@@ -528,7 +528,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
}
QList<QLineF *> elmt_line = elmt -> lines();
foreach(QLineF *line, elmt_line) {
for (QLineF *line: elmt_line) {
qreal x1 = (elem_pos_x + line -> p1().x()) * Createdxf::xScale;
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + line -> p1().y()) * Createdxf::yScale;
QPointF transformed_point = rotation_transformed(x1, y1, hotspot_x, hotspot_y, rotation_angle);
@@ -543,7 +543,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
}
QList<QRectF *> elmt_rectangle = elmt -> rectangles();
foreach(QRectF *rect, elmt_rectangle) {
for (QRectF *rect: elmt_rectangle) {
qreal x1 = (elem_pos_x + rect -> bottomLeft().x()) * Createdxf::xScale;
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + rect -> bottomLeft().y()) * Createdxf::yScale;
qreal w = rect -> width() * Createdxf::xScale;
@@ -565,7 +565,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
}
QList<QRectF *> elmt_circle = elmt -> circles();
foreach(QRectF *circle_rect, elmt_circle) {
for (QRectF *circle_rect: elmt_circle) {
qreal x1 = (elem_pos_x + circle_rect ->center().x()) * Createdxf::xScale;
qreal y1 = Createdxf::sheetHeight - (elem_pos_y + circle_rect -> center().y()) * Createdxf::yScale;
qreal r = circle_rect -> width() * Createdxf::xScale / 2;
@@ -576,7 +576,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
}
QList<QVector<QPointF> *> elmt_polygon = elmt -> polygons();
foreach(QVector<QPointF> *polygon, elmt_polygon) {
for (QVector<QPointF> *polygon: elmt_polygon) {
if (polygon -> size() == 0)
continue;
qreal x1 = (elem_pos_x + polygon -> at(0).x()) * Createdxf::xScale;
@@ -598,7 +598,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
// Draw arcs and ellipses
QList<QVector<qreal> *> elmt_arc = elmt -> arcs();
foreach(QVector<qreal> *arc, elmt_arc) {
for (QVector<qreal> *arc: elmt_arc) {
if (arc -> size() == 0)
continue;
qreal x = (elem_pos_x + arc -> at(0)) * Createdxf::xScale;
@@ -612,8 +612,8 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
}
//Draw conductors
foreach(Conductor *cond, list_conductors) {
foreach(ConductorSegment *segment, cond -> segmentsList()) {
for (Conductor *cond: list_conductors) {
for (ConductorSegment *segment: cond -> segmentsList()) {
qreal x1 = (segment -> firstPoint().x()) * Createdxf::xScale;
qreal y1 = Createdxf::sheetHeight - (segment -> firstPoint().y() * Createdxf::yScale);
qreal x2 = (segment -> secondPoint().x()) * Createdxf::xScale;
@@ -630,7 +630,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
qreal x = (textItem -> pos().x()) * Createdxf::xScale;
qreal y = Createdxf::sheetHeight - (textItem -> pos().y() * Createdxf::yScale) - fontSize;
QStringList lines = textItem->toPlainText().split('\n');
foreach (QString line, lines) {
for (QString line: lines) {
qreal angle = 360 - (textItem -> rotationAngle());
if (line.size() > 0 && line != "_" )
Createdxf::drawText(file_path, line, x, y, fontSize, angle, 0 );
@@ -651,7 +651,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
}
//Draw text items
foreach(DiagramTextItem *dti, list_texts) {
for (DiagramTextItem *dti: list_texts) {
qreal fontSize = dti -> font().pointSizeF();
if (fontSize < 0)
fontSize = dti -> font().pixelSize();
@@ -659,7 +659,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
qreal x = (dti -> pos().x()) * Createdxf::xScale;
qreal y = Createdxf::sheetHeight - (dti -> pos().y() * Createdxf::yScale) - fontSize*1.05;
QStringList lines = dti -> toPlainText().split('\n');
foreach (QString line, lines) {
for (QString line: lines) {
qreal angle = 360 - (dti -> rotationAngle());
if (line.size() > 0 && line != "_" )
Createdxf::drawText(file_path, line, x, y, fontSize, angle, 0);
@@ -742,7 +742,7 @@ QPointF ExportDialog::rotation_transformed(qreal px, qreal py , qreal origin_x,
void ExportDialog::slot_export() {
// recupere la liste des schemas a exporter
QList<ExportDiagramLine *> diagrams_to_export;
foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) {
for (ExportDiagramLine *diagram_line: diagram_lines_.values()) {
if (diagram_line -> must_export -> isChecked()) {
diagrams_to_export << diagram_line;
}
@@ -750,7 +750,7 @@ void ExportDialog::slot_export() {
// verification #1 : chaque schema coche doit avoir un nom de fichier distinct
QSet<QString> filenames;
foreach(ExportDiagramLine *diagram_line, diagrams_to_export) {
for (ExportDiagramLine *diagram_line: diagrams_to_export) {
QString diagram_file = diagram_line -> file_name -> text();
if (!diagram_file.isEmpty()) {
filenames << diagram_file;
@@ -783,7 +783,7 @@ void ExportDialog::slot_export() {
}
// exporte chaque schema a exporter
foreach(ExportDiagramLine *diagram_line, diagrams_to_export) {
for (ExportDiagramLine *diagram_line: diagrams_to_export) {
exportDiagram(diagram_line);
}
@@ -868,7 +868,7 @@ void ExportDialog::exportDiagram(ExportDiagramLine *diagram_line) {
*/
void ExportDialog::slot_changeUseBorder() {
// parcourt les schemas a exporter
foreach(int diagram_id, diagram_lines_.keys()) {
for (int diagram_id: diagram_lines_.keys()) {
ExportDiagramLine *diagram_line = diagram_lines_[diagram_id];
// corrige les dimensions des schemas dont il faut preserver le ratio
@@ -900,7 +900,7 @@ void ExportDialog::slot_changeFilesExtension(bool force_extension) {
QString format_extension = "." + format_acronym.toLower();
// parcourt les schemas a exporter
foreach(ExportDiagramLine *diagram_line, diagram_lines_.values()) {
for (ExportDiagramLine *diagram_line: diagram_lines_.values()) {
QString diagram_filename = diagram_line -> file_name -> text();
// cas 1 : l'extension est presente et correcte : on ne fait rien
@@ -959,7 +959,7 @@ void ExportDialog::slot_previewDiagram(int diagram_id) {
);
// nettoie l'apercu
foreach (QGraphicsItem *qgi, preview_scene -> items()) {
for (QGraphicsItem *qgi: preview_scene -> items()) {
preview_scene -> removeItem(qgi);
delete qgi;
}

View File

@@ -210,7 +210,7 @@ QTreeWidgetItem *GenericPanel::fillProjectItem(QTreeWidgetItem *project_qtwi, QE
removeObsoleteItems(project -> diagrams(), project_qtwi, QET::Diagram, false);
}
int index = 0;
foreach (Diagram *diagram, project -> diagrams()) {
for (Diagram *diagram: project -> diagrams()) {
QTreeWidgetItem *diagram_qtwi = addDiagram(diagram, 0, options);
project_qtwi -> insertChild(index, diagram_qtwi);
++ index;
@@ -428,7 +428,7 @@ QTreeWidgetItem *GenericPanel::fillTemplatesCollectionItem(QTreeWidgetItem *tbt_
}
int index = 0;
foreach (QString template_name, tbt_collection -> templates()) {
for (QString template_name: tbt_collection -> templates()) {
QTreeWidgetItem *template_item = addTemplate(tbt_collection -> location(template_name), 0, options);
tbt_collection_qtwi -> insertChild(index ++, template_item);
}
@@ -770,7 +770,7 @@ QList<QTreeWidgetItem *> GenericPanel::childItems(QTreeWidgetItem *item, QET::It
template<typename T>
void GenericPanel::removeObsoleteItems(const QList<T> &expected_items, QTreeWidgetItem *item, QET::ItemType type, bool recursive) {
// remove items not found in expected_items
foreach (QTreeWidgetItem *child_item, childItems(item, type, recursive)) {
for (QTreeWidgetItem *child_item: childItems(item, type, recursive)) {
T child_value = valueForItem<T>(child_item);
if (!expected_items.contains(child_value)) {
deleteItem(child_item);

View File

@@ -133,7 +133,7 @@ NamesList NamesListWidget::names() {
Definit les noms que le widget doit afficher
*/
void NamesListWidget::setNames(const NamesList &provided_names) {
foreach(QString lang, provided_names.langs()) {
for (QString lang: provided_names.langs()) {
QString value = provided_names[lang];
QStringList values;
values << lang << value;

View File

@@ -103,7 +103,7 @@ QString nomenclature::getNomenclature()
if(m_list_diagram.isEmpty()) return data;
foreach (Diagram *d, m_list_diagram) {
for (Diagram *d: m_list_diagram) {
//Get only simple, master and unlinked slave element.
ElementProvider ep(d);
QSettings settings;
@@ -120,7 +120,7 @@ QString nomenclature::getNomenclature()
list_elements << ep.freeElement(Element::Slave);
foreach (Element *elmt, list_elements) {
for (Element *elmt: list_elements) {
data += getElementInfo(elmt);
}
}

View File

@@ -385,19 +385,19 @@ void ProjectAutoNumConfigPage::readValuesFromProject() {
//Conductor Tab
QList <QString> keys_conductor = m_project->conductorAutoNum().keys();
if (!keys_conductor.isEmpty()){
foreach (QString str, keys_conductor) { m_context_cb_conductor-> addItem(str); }
for (QString str: keys_conductor) { m_context_cb_conductor-> addItem(str); }
}
//Element Tab
QList <QString> keys_element = m_project->elementAutoNum().keys();
if (!keys_element.isEmpty()){
foreach (QString str, keys_element) { m_context_cb_element -> addItem(str);}
for (QString str: keys_element) { m_context_cb_element -> addItem(str);}
}
//Folio Tab
QList <QString> keys_folio = m_project->folioAutoNum().keys();
if (!keys_folio.isEmpty()){
foreach (QString str, keys_folio) { m_context_cb_folio -> addItem(str);}
for (QString str: keys_folio) { m_context_cb_folio -> addItem(str);}
}
//Folio AutoNumbering Tab

View File

@@ -55,7 +55,7 @@ ProjectView::ProjectView(QETProject *project, QWidget *parent) :
*/
ProjectView::~ProjectView() {
// qDebug() << "Suppression du ProjectView" << ((void *)this);
foreach(int id, diagram_ids_.keys()) {
for (int id: diagram_ids_.keys()) {
DiagramView *diagram_view = diagram_ids_.take(id);
delete diagram_view;
}
@@ -281,12 +281,12 @@ bool ProjectView::tryClosingElementEditors() {
editant un element du projet.
*/
QList<QETElementEditor *> editors = QETApp::elementEditors(m_project);
foreach(QETElementEditor *editor, editors) {
for (QETElementEditor *editor: editors) {
if (!editor -> close()) return(false);
}
QList<QETTitleBlockTemplateEditor *> template_editors = QETApp::titleBlockTemplateEditors(m_project);
foreach(QETTitleBlockTemplateEditor *template_editor, template_editors) {
for (QETTitleBlockTemplateEditor *template_editor: template_editors) {
if (!template_editor -> close()) return(false);
}
return(true);
@@ -389,7 +389,7 @@ void ProjectView::addNewDiagramFolioList() {
if (m_project -> isReadOnly()) return;
int i = 1; //< Each new diagram is added to the end of the project.
//< We use @i to move the folio list at second position in the project
foreach (Diagram *d, m_project -> addNewDiagramFolioList()) {
for (Diagram *d: m_project -> addNewDiagramFolioList()) {
DiagramView *new_diagram_view = new DiagramView(d);
addDiagram(new_diagram_view);
showDiagram(new_diagram_view);
@@ -745,7 +745,7 @@ QETResult ProjectView::doSave(ProjectSaveOptions options) {
the project file itself.
*/
void ProjectView::saveDiagrams(const QList<Diagram *> &diagrams) {
foreach (Diagram *diagram, diagrams) {
for (Diagram *diagram: diagrams) {
// Diagram::write() emits the written() signal, which is connected
// to QETProject::write() through QETProject::componentWritten().
// We do not want to write the project immediately, so we block
@@ -892,7 +892,7 @@ void ProjectView::loadDiagrams() {
setDisplayFallbackWidget(m_project -> diagrams().isEmpty());
foreach(Diagram *diagram, m_project -> diagrams()) {
for (Diagram *diagram: m_project -> diagrams()) {
DiagramView *sv = new DiagramView(diagram);
addDiagram(sv);
}
@@ -972,7 +972,7 @@ void ProjectView::tabMoved(int from, int to) {
le schema n'est pas trouve
*/
DiagramView *ProjectView::findDiagram(Diagram *diagram) {
foreach(DiagramView *diagram_view, diagrams()) {
for (DiagramView *diagram_view: diagrams()) {
if (diagram_view -> diagram() == diagram) {
return(diagram_view);
}
@@ -987,7 +987,7 @@ void ProjectView::rebuildDiagramsMap() {
// vide la map
diagram_ids_.clear();
foreach(DiagramView *diagram_view, m_diagram_view_list) {
for (DiagramView *diagram_view: m_diagram_view_list) {
int dv_idx = m_tab -> indexOf(diagram_view);
if (dv_idx == -1) continue;
diagram_ids_.insert(dv_idx, diagram_view);

View File

@@ -51,7 +51,7 @@ void XRefProperties::toSettings(QSettings &settings, const QString prefix) const
settings.setValue(prefix + "master_label", master_label);
QString slave_label = m_slave_label;
settings.setValue(prefix + "slave_label", slave_label);
foreach (QString key, m_prefix.keys()) {
for (QString key: m_prefix.keys()) {
settings.setValue(prefix + key + "prefix", m_prefix.value(key));
}
}
@@ -71,7 +71,7 @@ void XRefProperties::fromSettings(const QSettings &settings, const QString prefi
m_offset = settings.value(prefix + "offset", "0").toInt();
m_master_label = settings.value(prefix + "master_label", "%f-%l%c").toString();
m_slave_label = settings.value(prefix + "slave_label", "(%f-%l%c)").toString();
foreach (QString key, m_prefix_keys) {
for (QString key: m_prefix_keys) {
m_prefix.insert(key, settings.value(prefix + key + "prefix").toString());
}
}
@@ -93,7 +93,7 @@ void XRefProperties::toXml(QDomElement &xml_element) const {
xml_element.setAttribute("master_label", master_label);
QString slave_label = m_slave_label;
xml_element.setAttribute("slave_label", slave_label);
foreach (QString key, m_prefix.keys()) {
for (QString key: m_prefix.keys()) {
xml_element.setAttribute(key + "prefix", m_prefix.value(key));
}
}
@@ -112,7 +112,7 @@ void XRefProperties::fromXml(const QDomElement &xml_element) {
m_offset = xml_element.attribute("offset", "0").toInt();
m_master_label = xml_element.attribute("master_label", "%f-%l%c");
m_slave_label = xml_element.attribute("slave_label","(%f-%l%c)");
foreach (QString key, m_prefix_keys) {
for (QString key: m_prefix_keys) {
m_prefix.insert(key, xml_element.attribute(key + "prefix"));
}
}
@@ -132,7 +132,7 @@ QHash<QString, XRefProperties> XRefProperties::defaultProperties()
QSettings settings;
foreach (QString key, keys)
for (QString key: keys)
{
XRefProperties properties;
QString str("diagrameditor/defaultxref");

View File

@@ -398,7 +398,7 @@ QString QET::stringToFileName(const QString &name) {
QString file_name(name.toLower());
// remplace les caracteres interdits par des tirets
foreach(QChar c, QET::forbiddenCharacters()) {
for (QChar c: QET::forbiddenCharacters()) {
file_name.replace(c, '-');
}
@@ -454,7 +454,7 @@ QStringList QET::splitWithSpaces(const QString &string) {
QStringList escaped_strings = string.split(QRegExp("[^\\]?(?:\\\\)* "), QString::SkipEmptyParts);
QStringList returned_list;
foreach(QString escaped_string, escaped_strings) {
for (QString escaped_string: escaped_strings) {
returned_list << QET::unescapeSpaces(escaped_string);
}
return(returned_list);
@@ -670,7 +670,7 @@ QPointF QET::graphicsSceneEventPos(QEvent *event) {
*/
bool QET::eachStrIsEqual(const QStringList &qsl) {
if (qsl.size() == 1) return true;
foreach (const QString t, qsl) {
for (const QString t: qsl) {
if (qsl.at(0) != t) return false;
}
return true;

View File

@@ -360,7 +360,7 @@ QList<TitleBlockTemplatesCollection *> QETApp::availableTitleBlockTemplatesColle
collections_list << common_tbt_collection_;
collections_list << custom_tbt_collection_;
foreach(QETProject *opened_project, registered_projects_) {
for (QETProject *opened_project: registered_projects_) {
collections_list << opened_project -> embeddedTitleBlockTemplatesCollection();
}
@@ -582,7 +582,7 @@ QStringList QETApp::handledFileExtensions() {
*/
QStringList QETApp::handledFiles(const QList<QUrl> &urls) {
QList<QString> filepaths;
foreach (QUrl url, urls) {
for (QUrl url: urls) {
if (url.scheme() != "file") continue;
QString local_path = url.toLocalFile();
QFileInfo local_path_info(local_path);
@@ -604,7 +604,7 @@ QETDiagramEditor *QETApp::diagramEditorForFile(const QString &filepath) {
if (filepath.isEmpty()) return(0);
QETApp *qet_app(QETApp::instance());
foreach (QETDiagramEditor *diagram_editor, qet_app -> diagramEditors()) {
for (QETDiagramEditor *diagram_editor: qet_app -> diagramEditors()) {
if (diagram_editor -> viewForFile(filepath)) {
return(diagram_editor);
}
@@ -621,7 +621,7 @@ QETDiagramEditor *QETApp::diagramEditorForFile(const QString &filepath) {
*/
QETDiagramEditor *QETApp::diagramEditorAncestorOf (const QWidget *child)
{
foreach (QETDiagramEditor *qde, QETApp::diagramEditors()) {
for (QETDiagramEditor *qde: QETApp::diagramEditors()) {
if (qde->isAncestorOf(child)) {
return qde;
}
@@ -713,14 +713,14 @@ QString QETApp::languagesPath() {
bool QETApp::closeEveryEditor() {
// s'assure que toutes les fenetres soient visibles avant de quitter
restoreEveryEditor();
foreach(QETProject *project, registered_projects_) {
for (QETProject *project: registered_projects_) {
project -> close();
}
bool every_window_closed = true;
foreach(QETDiagramEditor *e, diagramEditors()) {
for (QETDiagramEditor *e: diagramEditors()) {
every_window_closed = every_window_closed && e -> close();
}
foreach(QETElementEditor *e, elementEditors()) {
for (QETElementEditor *e: elementEditors()) {
every_window_closed = every_window_closed && e -> close();
}
return(every_window_closed);
@@ -782,8 +782,8 @@ QList<QETTitleBlockTemplateEditor *> QETApp::titleBlockTemplateEditors(QETProjec
QList<QETTitleBlockTemplateEditor *> editors;
if (!project) return(editors);
// foreach known template editor
foreach (QETTitleBlockTemplateEditor *tbt_editor, titleBlockTemplateEditors()) {
// for known template editor
for (QETTitleBlockTemplateEditor *tbt_editor: titleBlockTemplateEditors()) {
if (tbt_editor -> location().parentProject() == project) {
editors << tbt_editor;
}
@@ -839,7 +839,7 @@ QList<QETElementEditor *> QETApp::elementEditors(QETProject *project) {
if (!project) return(editors);
// pour chaque editeur d'element...
foreach(QETElementEditor *elmt_editor, elementEditors()) {
for (QETElementEditor *elmt_editor: elementEditors()) {
// on recupere l'emplacement de l'element qu'il edite
ElementsLocation elmt_editor_loc(elmt_editor -> location());
@@ -867,7 +867,7 @@ void QETApp::cleanup() {
*/
template <class T> QList<T *> QETApp::detectWindows() const {
QList<T *> windows;
foreach(QWidget *widget, topLevelWidgets()) {
for (QWidget *widget: topLevelWidgets()) {
if (!widget -> isWindow()) continue;
if (T *window = qobject_cast<T *>(widget)) {
windows << window;
@@ -881,7 +881,7 @@ template <class T> QList<T *> QETApp::detectWindows() const {
@param visible whether detected main windows should be visible
*/
template <class T> void QETApp::setMainWindowsVisible(bool visible) {
foreach(T *e, detectWindows<T>()) {
for (T *e: detectWindows<T>()) {
setMainWindowVisible(e, visible);
}
}
@@ -912,7 +912,7 @@ void QETApp::setMainWindowVisible(QMainWindow *window, bool visible) {
window_states.insert(window, window -> saveState());
window -> hide();
// cache aussi les toolbars et les docks
foreach (QWidget *qw, floatingToolbarsAndDocksForMainWindow(window)) {
for (QWidget *qw: floatingToolbarsAndDocksForMainWindow(window)) {
qw -> hide();
}
} else {
@@ -1044,7 +1044,7 @@ void QETApp::openProjectFiles(const QStringList &files_list) {
// s'il y a des editeur de schemas ouvert, on cherche ceux qui sont visibles
if (diagrams_editors.count()) {
QList<QETDiagramEditor *> visible_diagrams_editors;
foreach(QETDiagramEditor *de, diagrams_editors) {
for (QETDiagramEditor *de: diagrams_editors) {
if (de -> isVisible()) visible_diagrams_editors << de;
}
@@ -1058,7 +1058,7 @@ void QETApp::openProjectFiles(const QStringList &files_list) {
}
// ouvre les fichiers dans l'editeur ainsi choisi
foreach(QString file, files_list) {
for (QString file: files_list) {
de_open -> openAndAddProject(file);
}
} else {
@@ -1077,7 +1077,7 @@ void QETApp::openElementFiles(const QStringList &files_list) {
// evite autant que possible les doublons dans la liste fournie
QSet<QString> files_set;
foreach(QString file, files_list) {
for (QString file: files_list) {
QString canonical_filepath = QFileInfo(file).canonicalFilePath();
if (!canonical_filepath.isEmpty()) files_set << canonical_filepath;
}
@@ -1088,9 +1088,9 @@ void QETApp::openElementFiles(const QStringList &files_list) {
QList<QETElementEditor *> element_editors = elementEditors();
// on traite les fichiers a la queue leu leu...
foreach(QString element_file, files_set) {
for (QString element_file: files_set) {
bool already_opened_in_existing_element_editor = false;
foreach(QETElementEditor *element_editor, element_editors) {
for (QETElementEditor *element_editor: element_editors) {
if (element_editor -> isEditing(element_file)) {
// ce fichier est deja ouvert dans un editeur
already_opened_in_existing_element_editor = true;
@@ -1120,9 +1120,9 @@ void QETApp::openElementLocations(const QList<ElementsLocation> &locations_list)
QList<QETElementEditor *> element_editors = elementEditors();
// on traite les emplacements a la queue leu leu...
foreach(ElementsLocation element_location, locations_list) {
for (ElementsLocation element_location: locations_list) {
bool already_opened_in_existing_element_editor = false;
foreach(QETElementEditor *element_editor, element_editors) {
for (QETElementEditor *element_editor: element_editors) {
if (element_editor -> isEditing(element_location)) {
// cet emplacement est deja ouvert dans un editeur
already_opened_in_existing_element_editor = true;
@@ -1175,7 +1175,7 @@ void QETApp::openTitleBlockTemplateFiles(const QStringList &files_list) {
// avoid duplicates in the provided files list
QSet<QString> files_set;
foreach (QString file, files_list) {
for (QString file: files_list) {
QString canonical_filepath = QFileInfo(file).canonicalFilePath();
if (!canonical_filepath.isEmpty()) files_set << canonical_filepath;
}
@@ -1185,9 +1185,9 @@ void QETApp::openTitleBlockTemplateFiles(const QStringList &files_list) {
// opened title block template editors
QList<QETTitleBlockTemplateEditor *> tbt_editors = titleBlockTemplateEditors();
foreach(QString tbt_file, files_set) {
for (QString tbt_file: files_set) {
bool already_opened_in_existing_tbt_editor = false;
foreach(QETTitleBlockTemplateEditor *tbt_editor, tbt_editors) {
for (QETTitleBlockTemplateEditor *tbt_editor: tbt_editors) {
if (tbt_editor -> isEditing(tbt_file)) {
// this file is already opened
already_opened_in_existing_tbt_editor = true;
@@ -1267,7 +1267,7 @@ void QETApp::aboutQET() {
*/
QList<QWidget *> QETApp::floatingToolbarsAndDocksForMainWindow(QMainWindow *window) const {
QList<QWidget *> widgets;
foreach(QWidget *qw, topLevelWidgets()) {
for (QWidget *qw: topLevelWidgets()) {
if (!qw -> isWindow()) continue;
if (qobject_cast<QToolBar *>(qw) || qobject_cast<QDockWidget *>(qw)) {
if (qw -> parent() == window) widgets << qw;
@@ -1455,7 +1455,7 @@ void QETApp::initSystemTray() {
*/
template <class T> void QETApp::addWindowsListToMenu(QMenu *menu, const QList<T *> &windows) {
menu -> addSeparator();
foreach (QMainWindow *window, windows) {
for (QMainWindow *window: windows) {
QAction *current_menu = menu -> addAction(window -> windowTitle());
current_menu -> setCheckable(true);
current_menu -> setChecked(window -> isVisible());
@@ -1547,19 +1547,19 @@ void QETApp::fetchWindowStats(
) {
// compte le nombre de schemas visibles
int visible_diagrams = 0;
foreach(QMainWindow *w, diagrams) if (w -> isVisible()) ++ visible_diagrams;
for (QMainWindow *w: diagrams) if (w -> isVisible()) ++ visible_diagrams;
every_diagram_reduced = !visible_diagrams;
every_diagram_visible = visible_diagrams == diagrams.count();
// compte le nombre de schemas visibles
int visible_elements = 0;
foreach(QMainWindow *w, elements) if (w -> isVisible()) ++ visible_elements;
for (QMainWindow *w: elements) if (w -> isVisible()) ++ visible_elements;
every_element_reduced = !visible_elements;
every_element_visible = visible_elements == elements.count();
// count visible template editors
int visible_templates = 0;
foreach(QMainWindow *window, tbtemplates) {
for (QMainWindow *window: tbtemplates) {
if (window -> isVisible()) ++ visible_templates;
}
every_template_reduced = !visible_templates;
@@ -1683,7 +1683,7 @@ QETProject *QETApp::project(const uint &id) {
@return l'id du projet en parametre si celui-ci est enregistre, -1 sinon
*/
int QETApp::projectId(const QETProject *project) {
foreach(int id, registered_projects_.keys()) {
for (int id: registered_projects_.keys()) {
if (registered_projects_[id] == project) {
return(id);
}

View File

@@ -193,7 +193,7 @@ void QETArguments::parseArguments(const QList<QString> &arguments) {
clear();
// separe les fichiers des options
foreach(QString argument, arguments) {
for (QString argument: arguments) {
QFileInfo argument_info(argument);
if (argument_info.exists()) {
// on exprime les chemins des fichiers en absolu

View File

@@ -111,7 +111,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
if (files.count())
{
//So we open this files
foreach(QString file, files)
for (QString file: files)
if (openAndAddProject(file, false))
++ opened_projects;
}
@@ -282,8 +282,8 @@ void QETDiagramEditor::setUpActions()
m_draw_grid->setCheckable(true);
m_draw_grid->setChecked(true);
connect(m_draw_grid, &QAction::triggered, [this](bool checked) {
foreach (ProjectView *prjv, this->openedProjects())
foreach (Diagram *d, prjv->project()->diagrams()) {
for (ProjectView *prjv: this->openedProjects())
for (Diagram *d: prjv->project()->diagrams()) {
d->setDisplayGrid(checked);
d->update();
}
@@ -436,7 +436,7 @@ void QETDiagramEditor::setUpActions()
add_ellipse ->setData("ellipse");
add_polyline ->setData("polyline");
foreach (QAction *action, m_add_item_actions_group.actions()) action->setCheckable(true);
for (QAction *action: m_add_item_actions_group.actions()) action->setCheckable(true);
connect(&m_add_item_actions_group, &QActionGroup::triggered, this, &QETDiagramEditor::addItemGroupTriggered);
//Keyboard shortcut
@@ -657,7 +657,7 @@ void QETDiagramEditor::closeEvent(QCloseEvent *qce) {
else showNormal();
}
// sinon demande la permission de fermer chaque projet
foreach(ProjectView *project, openedProjects()) {
for (ProjectView *project: openedProjects()) {
if (!closeProject(project)) {
can_quit = false;
qce -> ignore();
@@ -985,7 +985,7 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) {
QList<ProjectView *> QETDiagramEditor::openedProjects() const {
QList<ProjectView *> result;
QList<QMdiSubWindow *> window_list(workspace.subWindowList());
foreach(QMdiSubWindow *window, window_list) {
for (QMdiSubWindow *window: window_list) {
if (ProjectView *project_view = qobject_cast<ProjectView *>(window -> widget())) {
result << project_view;
}
@@ -1054,7 +1054,7 @@ CustomElement *QETDiagramEditor::currentCustomElement() const {
@return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas
*/
ProjectView *QETDiagramEditor::findProject(DiagramView *diagram_view) const {
foreach(ProjectView *project_view, openedProjects()) {
for (ProjectView *project_view: openedProjects()) {
if (project_view -> diagrams().contains(diagram_view)) {
return(project_view);
}
@@ -1068,8 +1068,8 @@ ProjectView *QETDiagramEditor::findProject(DiagramView *diagram_view) const {
@return la vue sur le projet contenant ce schema ou 0 s'il n'y en a pas
*/
ProjectView *QETDiagramEditor::findProject(Diagram *diagram) const {
foreach(ProjectView *project_view, openedProjects()) {
foreach(DiagramView *diagram_view, project_view -> diagrams()) {
for (ProjectView *project_view: openedProjects()) {
for (DiagramView *diagram_view: project_view -> diagrams()) {
if (diagram_view -> diagram() == diagram) {
return(project_view);
}
@@ -1083,7 +1083,7 @@ ProjectView *QETDiagramEditor::findProject(Diagram *diagram) const {
@return la vue du projet passe en parametre
*/
ProjectView *QETDiagramEditor::findProject(QETProject *project) const {
foreach(ProjectView *opened_project, openedProjects()) {
for (ProjectView *opened_project: openedProjects()) {
if (opened_project -> project() == project) {
return(opened_project);
}
@@ -1097,7 +1097,7 @@ ProjectView *QETDiagramEditor::findProject(QETProject *project) const {
celui-ci n'a pas ete trouve
*/
ProjectView *QETDiagramEditor::findProject(const QString &filepath) const {
foreach(ProjectView *opened_project, openedProjects()) {
for (ProjectView *opened_project: openedProjects()) {
if (QETProject *project = opened_project -> project()) {
if (project -> filePath() == filepath) {
return(opened_project);
@@ -1113,7 +1113,7 @@ ProjectView *QETDiagramEditor::findProject(const QString &filepath) const {
celui-ci n'a pas ete trouve.
*/
QMdiSubWindow *QETDiagramEditor::subWindowForWidget(QWidget *widget) const {
foreach(QMdiSubWindow *sub_window, workspace.subWindowList()) {
for (QMdiSubWindow *sub_window: workspace.subWindowList()) {
if (sub_window -> widget() == widget) {
return(sub_window);
}
@@ -1284,7 +1284,7 @@ void QETDiagramEditor::rowColumnGroupTriggered(QAction *action)
void QETDiagramEditor::slot_setSelectionMode()
{
if (ProjectView *pv = currentProject())
foreach(DiagramView *dv, pv -> diagrams())
for (DiagramView *dv: pv -> diagrams())
dv -> setSelectionMode();
}
@@ -1295,7 +1295,7 @@ void QETDiagramEditor::slot_setSelectionMode()
void QETDiagramEditor::slot_setVisualisationMode()
{
if (ProjectView *pv = currentProject())
foreach(DiagramView *dv, pv -> diagrams())
for (DiagramView *dv: pv -> diagrams())
dv -> setVisualisationMode();
}
@@ -1506,7 +1506,7 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view)
{
if (!project_view) return;
foreach(DiagramView *dv, project_view -> diagrams())
for (DiagramView *dv: project_view -> diagrams())
diagramWasAdded(dv);
//Manage the close event of project
@@ -1543,7 +1543,7 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view)
*/
QList<QString> QETDiagramEditor::editedFiles() const {
QList<QString> edited_files_list;
foreach (ProjectView *project_view, openedProjects()) {
for (ProjectView *project_view: openedProjects()) {
QString diagram_file(project_view -> project() -> filePath());
if (!diagram_file.isEmpty()) {
edited_files_list << QFileInfo(diagram_file).canonicalFilePath();
@@ -1566,7 +1566,7 @@ ProjectView *QETDiagramEditor::viewForFile(const QString &filepath) const {
// QFileInfo returns an empty path for non-existent files
return(0);
}
foreach (ProjectView *project_view, openedProjects()) {
for (ProjectView *project_view: openedProjects()) {
QString project_can_file_path = QFileInfo(project_view -> project() -> filePath()).canonicalFilePath();
if (project_can_file_path == searched_can_file_path) {
return(project_view);
@@ -1616,7 +1616,7 @@ DiagramView *QETDiagramEditor::acessCurrentDiagramView () {
*/
void QETDiagramEditor::slot_updateWindowsMenu() {
// nettoyage du menu
foreach(QAction *a, windows_menu -> actions()) windows_menu -> removeAction(a);
for (QAction *a: windows_menu -> actions()) windows_menu -> removeAction(a);
// actions de fermeture
windows_menu -> addAction(close_file);
@@ -1642,7 +1642,7 @@ void QETDiagramEditor::slot_updateWindowsMenu() {
if (!windows.isEmpty()) windows_menu -> addSeparator();
QActionGroup *windows_actions = new QActionGroup(this);
foreach(ProjectView *project_view, windows) {
for (ProjectView *project_view: windows) {
QString pv_title = project_view -> windowTitle();
QAction *action = windows_menu -> addAction(pv_title);
windows_actions -> addAction(action);
@@ -2035,7 +2035,7 @@ void QETDiagramEditor::removeDiagramFromProject() {
// if the removed diagram was a folio sheet, then delete all the remaining folio sheets also.
if (isFolioList) {
foreach (DiagramView *diag, current_project -> diagrams()) {
for (DiagramView *diag: current_project -> diagrams()) {
if (dynamic_cast<DiagramFolioList *>(diag -> diagram())) {
current_project -> removeDiagram(diag);
}
@@ -2044,7 +2044,7 @@ void QETDiagramEditor::removeDiagramFromProject() {
// else if after diagram removal, the total diagram quantity becomes a factor of 58, then
// remove one (last) folio sheet.
} else if (current_project -> diagrams().size() % 58 == 0) {
foreach (DiagramView *diag, current_project -> diagrams()) {
for (DiagramView *diag: current_project -> diagrams()) {
DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diag -> diagram());
if (ptr && ptr -> getId() == current_project -> project() -> getFolioSheetsQuantity() - 1) {
current_project -> removeDiagram(diag);

View File

@@ -280,13 +280,13 @@ QHash<ConductorSegmentProfile *, qreal> Conductor::shareOffsetBetweenSegments(
) const {
// construit le QHash qui sera retourne
QHash<ConductorSegmentProfile *, qreal> segments_hash;
foreach(ConductorSegmentProfile *csp, segments_list) {
for (ConductorSegmentProfile *csp: segments_list) {
segments_hash.insert(csp, csp -> length);
}
// memorise le signe de la longueur de chaque segement
QHash<ConductorSegmentProfile *, int> segments_signs;
foreach(ConductorSegmentProfile *csp, segments_hash.keys()) {
for (ConductorSegmentProfile *csp: segments_hash.keys()) {
segments_signs.insert(csp, getSign(csp -> length));
}
@@ -297,12 +297,12 @@ QHash<ConductorSegmentProfile *, qreal> Conductor::shareOffsetBetweenSegments(
while (remaining_offset > precision || remaining_offset < -precision) {
// recupere le nombre de segments differents ayant une longueur non nulle
uint segments_count = 0;
foreach(ConductorSegmentProfile *csp, segments_hash.keys()) if (segments_hash[csp]) ++ segments_count;
for (ConductorSegmentProfile *csp: segments_hash.keys()) if (segments_hash[csp]) ++ segments_count;
//qDebug() << " remaining_offset =" << remaining_offset;
qreal local_offset = remaining_offset / segments_count;
//qDebug() << " repartition d'un offset local de" << local_offset << "px sur" << segments_count << "segments";
remaining_offset = 0.0;
foreach(ConductorSegmentProfile *csp, segments_hash.keys()) {
for (ConductorSegmentProfile *csp: segments_hash.keys()) {
// ignore les segments de longueur nulle
if (!segments_hash[csp]) continue;
// applique l'offset au segment
@@ -526,7 +526,7 @@ void Conductor::paint(QPainter *qp, const QStyleOptionGraphicsItem *options, QWi
qp -> setPen(final_conductor_pen);
qp -> setBrush(junction_brush);
qp -> setRenderHint(QPainter::Antialiasing, true);
foreach(QPointF point, junctions_list) {
for (QPointF point: junctions_list) {
qp -> drawEllipse(QRectF(point.x() - 1.5, point.y() - 1.5, 3.0, 3.0));
}
}
@@ -764,7 +764,7 @@ QPainterPath Conductor::shape() const
https://qelectrotech.org/forum/viewtopic.php?pid=5067#p5067
**/
// if (isSelected()) {
// foreach (QRectF rect, m_handler.handlerRect(handlerPoints())) {
// for (QRectF rect, m_handler.handlerRect(handlerPoints())) {
// shape_.addRect(rect);
// }
// }
@@ -792,7 +792,7 @@ uint Conductor::segmentsCount(QET::ConductorSegmentType type) const {
QList<ConductorSegment *> segments_list = segmentsList();
if (type == QET::Both) return(segments_list.count());
uint nb_seg = 0;
foreach(ConductorSegment *conductor_segment, segments_list) {
for (ConductorSegment *conductor_segment: segments_list) {
if (conductor_segment -> type() == type) ++ nb_seg;
}
return(nb_seg);
@@ -895,7 +895,7 @@ QDomElement Conductor::toXml(QDomDocument &dom_document, QHash<Terminal *, int>
{
// parcours et export des segments
QDomElement current_segment;
foreach(ConductorSegment *segment, segmentsList())
for (ConductorSegment *segment: segmentsList())
{
current_segment = dom_document.createElement("segment");
current_segment.setAttribute("orientation", segment -> isHorizontal() ? "horizontal" : "vertical");
@@ -954,8 +954,8 @@ bool Conductor::pathFromXml(const QDomElement &e) {
// les longueurs recueillies doivent etre coherentes avec les positions des bornes
qreal width = 0.0, height = 0.0;
foreach (qreal t, segments_x) width += t;
foreach (qreal t, segments_y) height += t;
for (qreal t: segments_x) width += t;
for (qreal t: segments_y) height += t;
QPointF t1 = terminal1 -> dockConductor();
QPointF t2 = terminal2 -> dockConductor();
qreal expected_width = t2.x() - t1.x();
@@ -1009,7 +1009,7 @@ QVector<QPointF> Conductor::handlerPoints() const
QVector <QPointF> middle_points;
foreach(ConductorSegment *segment, sl)
for (ConductorSegment *segment: sl)
middle_points.append(segment->middle());
return middle_points;
@@ -1145,7 +1145,7 @@ void Conductor::calculateTextItemPosition() {
}
//At this point this conductor is the longuest conductor we hide all text of conductor_list
foreach (Conductor *c, relatedPotentialConductors(false)) {
for (Conductor *c: relatedPotentialConductors(false)) {
c -> textItem() -> setVisible(false);
}
//Make sure text item is visible
@@ -1295,7 +1295,7 @@ void Conductor::setPropertyToPotential(const ConductorProperties &property, bool
setProperties(property);
QSet <Conductor *> potential_list = relatedPotentialConductors();
foreach(Conductor *other_conductor, potential_list)
for (Conductor *other_conductor: potential_list)
{
if (only_text)
{
@@ -1400,7 +1400,7 @@ void Conductor::displayedTextChanged()
{
undo->setText(tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
foreach (Conductor *potential_conductor, relatedPotentialConductors())
for (Conductor *potential_conductor: relatedPotentialConductors())
{
old_value.setValue(potential_conductor->properties());
ConductorProperties new_properties = potential_conductor->properties();
@@ -1436,7 +1436,7 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram,
this_terminal << terminal1 << terminal2;
// Return all conductor of terminal 1 and 2
foreach (Terminal *terminal, this_terminal) {
for (Terminal *terminal: this_terminal) {
if (!t_list -> contains(terminal)) {
t_list -> append(terminal);
QList <Conductor *> other_conductors_list_t = terminal -> conductors();
@@ -1450,7 +1450,7 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram,
other_conductors_list_t.removeAll(this);
// Research the conductors connected to conductors already found
foreach (Conductor *c, other_conductors_list_t) {
for (Conductor *c: other_conductors_list_t) {
other_conductors += c -> relatedPotentialConductors(all_diagram, t_list);
}
other_conductors += other_conductors_list_t.toSet();
@@ -1554,7 +1554,7 @@ QList<QPointF> Conductor::junctions() const {
// determine si le point est une bifurcation ou non
bool is_bend = false;
Qt::Corner current_bend_type = Qt::TopLeftCorner;
foreach(ConductorBend cb, bends_list) {
for (ConductorBend cb: bends_list) {
if (cb.first == point) {
is_bend = true;
current_bend_type = cb.second;
@@ -1566,7 +1566,7 @@ QList<QPointF> Conductor::junctions() const {
bool is_junction = false;
QPointF scene_point = mapToScene(point);
foreach(Conductor *c, other_conductors) {
for (Conductor *c: other_conductors) {
// exprime le point dans les coordonnees de l'autre conducteur
QPointF conductor_point = c -> mapFromScene(scene_point);
// recupere les segments de l'autre conducteur
@@ -1580,7 +1580,7 @@ QList<QPointF> Conductor::junctions() const {
is_junction = true;
// ce point commun ne doit pas etre une bifurcation identique a celle-ci
QList<ConductorBend> other_conductor_bends = c -> bends();
foreach(ConductorBend cb, other_conductor_bends) {
for (ConductorBend cb: other_conductor_bends) {
if (cb.first == conductor_point && cb.second == current_bend_type) {
is_junction = false;
}
@@ -1714,7 +1714,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
QList<QPolygonF> polygons = polygon.simplified().toSubpathPolygons();
QList<QLineF> lines;
QList<QPointF> points;
foreach(QPolygonF polygon, polygons) {
for (QPolygonF polygon: polygons) {
if (polygon.count() <= 1) continue;
// on recense les lignes et les points
@@ -1727,7 +1727,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
// on fait des projetes orthogonaux du point sur les differents segments du
// polygone, en les triant par longueur croissante
QMap<qreal, QPointF> intersections;
foreach (QLineF line, lines) {
for (QLineF line: lines) {
QPointF intersection_point;
if (QET::orthogonalProjection(point, line, &intersection_point)) {
intersections.insert(QLineF(intersection_point, point).length(), intersection_point);
@@ -1764,7 +1764,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
Conductor * longuestConductorInPotential(Conductor *conductor, bool all_diagram) {
Conductor *longuest_conductor = conductor;
//Search the longuest conductor
foreach (Conductor *c, conductor -> relatedPotentialConductors(all_diagram))
for (Conductor *c: conductor -> relatedPotentialConductors(all_diagram))
if (c -> length() > longuest_conductor -> length())
longuest_conductor = c;

View File

@@ -209,7 +209,7 @@ void CrossRefItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
m_hovered_contact->setSelected(true);
//Zoom to the linked slave element
foreach(QGraphicsView *view, m_hovered_contact->diagram()->views())
for (QGraphicsView *view: m_hovered_contact->diagram()->views())
{
QRectF fit = m_hovered_contact->sceneBoundingRect();
fit.adjust(-200, -200, 200, 200);
@@ -230,7 +230,7 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
if (m_hovered_contact)
{
foreach(QRectF rect, m_hovered_contacts_map.values(m_hovered_contact))
for (QRectF rect: m_hovered_contacts_map.values(m_hovered_contact))
{
//Mouse hover the same rect than previous hover event
if (rect.contains(pos))
@@ -243,9 +243,9 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
//At this point, mouse don't hover previous rect
m_hovered_contact = nullptr;
foreach (Element *elmt, m_hovered_contacts_map.keys())
for (Element *elmt: m_hovered_contacts_map.keys())
{
foreach(QRectF rect, m_hovered_contacts_map.values(elmt))
for (QRectF rect: m_hovered_contacts_map.values(elmt))
{
//Mouse hover a contact
if (rect.contains(pos))
@@ -261,9 +261,9 @@ void CrossRefItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
}
else
{
foreach (Element *elmt, m_hovered_contacts_map.keys())
for (Element *elmt: m_hovered_contacts_map.keys())
{
foreach(QRectF rect, m_hovered_contacts_map.values(elmt))
for (QRectF rect: m_hovered_contacts_map.values(elmt))
{
//Mouse hover a contact
if (rect.contains(pos))
@@ -344,9 +344,9 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
QStringList no_str, nc_str;
foreach (Element *elmt, NOElements())
for (Element *elmt: NOElements())
no_str.append(elementPositionText(elmt, true));
foreach(Element *elmt, NCElements())
for (Element *elmt: NCElements())
nc_str.append(elementPositionText(elmt, true));
@@ -358,7 +358,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
//Bounding rect of the NO text
QRectF no_bounding;
foreach(QString str, no_str)
for (QString str: no_str)
{
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
no_bounding = no_bounding.united(bounding);
@@ -371,7 +371,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
//Bounding rect of the NC text
QRectF nc_bounding;
foreach(QString str, nc_str)
for (QString str: nc_str)
{
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
nc_bounding = nc_bounding.united(bounding);
@@ -434,7 +434,7 @@ void CrossRefItem::drawAsContacts(QPainter &painter)
QRectF bounding_rect;
//Draw each linked contact
foreach (Element *elmt, m_element->linkedElements())
for (Element *elmt: m_element->linkedElements())
{
DiagramContext info = elmt->kindInformations();
@@ -627,7 +627,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
//Fill NO
QPointF no_top_left(0, header);
foreach(Element *elmt, NOElements())
for (Element *elmt: NOElements())
{
QPen pen = painter.pen();
m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black);
@@ -651,7 +651,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
//Fill NC
QPointF nc_top_left(middle_cross, header);
foreach(Element *elmt, NCElements())
for (Element *elmt: NCElements())
{
QPen pen = painter.pen();
m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black);
@@ -731,7 +731,7 @@ QList<Element *> CrossRefItem::NOElements() const
{
QList<Element *> no_list;
foreach (Element *elmt, m_element->linkedElements())
for (Element *elmt: m_element->linkedElements())
{
//We continue if element is a power contact and xref propertie
//is set to don't show power contact
@@ -761,7 +761,7 @@ QList<Element *> CrossRefItem::NCElements() const
{
QList<Element *> nc_list;
foreach (Element *elmt, m_element->linkedElements())
for (Element *elmt: m_element->linkedElements())
{
//We continue if element is a power contact and xref propertie
//is set to don't show power contact

View File

@@ -211,7 +211,7 @@ QList<Terminal *> CustomElement::terminals() const {
/// @return la liste des conducteurs rattaches a cet element
QList<Conductor *> CustomElement::conductors() const {
QList<Conductor *> conductors;
foreach(Terminal *t, list_terminals) conductors << t -> conductors();
for (Terminal *t: list_terminals) conductors << t -> conductors();
return(conductors);
}
@@ -850,7 +850,7 @@ void CustomElement::setPainterStyle(QDomElement &e, QPainter &qp) {
// agit sur le QPen et la QBrush en fonction des valeurs rencontrees
QRegExp rx("^\\s*([a-z-]+)\\s*:\\s*([a-z-]+)\\s*$");
foreach (QString style, styles) {
for (QString style: styles) {
if (rx.exactMatch(style)) {
QString style_name = rx.cap(1);
QString style_value = rx.cap(2);
@@ -988,7 +988,7 @@ ElementTextItem* CustomElement::setTaggedText(const QString &tagg, const QString
* @param tagg
*/
ElementTextItem* CustomElement::taggedText(const QString &tagg) const {
foreach (ElementTextItem *eti, list_texts_) {
for (ElementTextItem *eti: list_texts_) {
if (eti -> tagg() == tagg) return eti;
}
return NULL;

View File

@@ -115,7 +115,7 @@ void Element::setHighlighted(bool hl) {
*/
void Element::displayHelpLine(bool b)
{
foreach (Terminal *t, terminals())
for (Terminal *t: terminals())
t->drawHelpLine(b);
}
@@ -225,14 +225,14 @@ void Element::rotateBy(const qreal &angle) {
applyRotation(applied_angle + rotation());
//update the path of conductor
foreach(QGraphicsItem *qgi, childItems()) {
for (QGraphicsItem *qgi: childItems()) {
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
p -> updateConductor();
}
}
// repositionne les textes de l'element qui ne comportent pas l'option "FollowParentRotations"
foreach(ElementTextItem *eti, texts()) {
for (ElementTextItem *eti: texts()) {
if (!eti -> followParentRotations()) {
// on souhaite pivoter le champ de texte par rapport a son centre
QPointF eti_center = eti -> boundingRect().center();
@@ -400,16 +400,16 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
ce recensement servira lors de la mise en place des fils
*/
QList<QDomElement> liste_terminals;
foreach(QDomElement qde, QET::findInDomElement(e, "terminals", "terminal")) {
for (QDomElement qde: QET::findInDomElement(e, "terminals", "terminal")) {
if (Terminal::valideXml(qde)) liste_terminals << qde;
}
QHash<int, Terminal *> priv_id_adr;
int terminals_non_trouvees = 0;
foreach(QGraphicsItem *qgi, childItems()) {
for (QGraphicsItem *qgi: childItems()) {
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
bool terminal_trouvee = false;
foreach(QDomElement qde, liste_terminals) {
for (QDomElement qde: liste_terminals) {
if (p -> fromXml(qde)) {
priv_id_adr.insert(qde.attribute("id").toInt(), p);
terminal_trouvee = true;
@@ -426,25 +426,25 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
return(false);
} else {
// verifie que les associations id / adr n'entrent pas en conflit avec table_id_adr
foreach(int id_trouve, priv_id_adr.keys()) {
for (int id_trouve: priv_id_adr.keys()) {
if (table_id_adr.contains(id_trouve)) {
// cet element possede un id qui est deja reference (= conflit)
return(false);
}
}
// copie des associations id / adr
foreach(int id_trouve, priv_id_adr.keys()) {
for (int id_trouve: priv_id_adr.keys()) {
table_id_adr.insert(id_trouve, priv_id_adr.value(id_trouve));
}
}
//import text filed value
QList<QDomElement> inputs = QET::findInDomElement(e, "inputs", "input");
foreach(QGraphicsItem *qgi, childItems())
for (QGraphicsItem *qgi: childItems())
{
if (ElementTextItem *eti = qgraphicsitem_cast<ElementTextItem *>(qgi))
{
foreach(QDomElement input, inputs)
for (QDomElement input: inputs)
{
eti -> fromXml(input);
etiToElementLabels(eti);
@@ -454,7 +454,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
//load uuid of connected elements
QList <QDomElement> uuid_list = QET::findInDomElement(e, "links_uuids", "link_uuid");
foreach (QDomElement qdo, uuid_list) tmp_uuids_link << qdo.attribute("uuid");
for (QDomElement qdo: uuid_list) tmp_uuids_link << qdo.attribute("uuid");
//uuid of this element
uuid_= QUuid(e.attribute("uuid", QUuid::createUuid().toString()));
@@ -540,7 +540,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
if (!table_adr_id.isEmpty()) {
// trouve le plus grand id
int max_id_t = -1;
foreach (int id_t, table_adr_id.values()) {
for (int id_t: table_adr_id.values()) {
if (id_t > max_id_t) max_id_t = id_t;
}
id_terminal = max_id_t + 1;
@@ -549,7 +549,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
// enregistrement des bornes de l'appareil
QDomElement xml_terminals = document.createElement("terminals");
// pour chaque enfant de l'element
foreach(Terminal *t, terminals()) {
for (Terminal *t: terminals()) {
// alors on enregistre la borne
QDomElement terminal = t -> toXml(document);
terminal.setAttribute("id", id_terminal);
@@ -560,7 +560,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
// enregistrement des champ de texte de l'appareil
QDomElement inputs = document.createElement("inputs");
foreach(ElementTextItem *eti, texts()) {
for (ElementTextItem *eti: texts()) {
inputs.appendChild(eti -> toXml(document));
}
element.appendChild(inputs);
@@ -569,7 +569,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
//save the uuid of each other elements
if (! isFree()) {
QDomElement links_uuids = document.createElement("links_uuids");
foreach (Element *elmt, connected_elements) {
for (Element *elmt: connected_elements) {
QDomElement link_uuid = document.createElement("link_uuid");
link_uuid.setAttribute("uuid", elmt->uuid().toString());
links_uuids.appendChild(link_uuid);
@@ -599,7 +599,7 @@ QList <QPair <Terminal *, Terminal *> > Element::AlignedFreeTerminals() const
{
QList <QPair <Terminal *, Terminal *> > list;
foreach (Terminal *terminal, terminals())
for (Terminal *terminal: terminals())
{
if (terminal->conductors().isEmpty())
{
@@ -627,7 +627,7 @@ void Element::initLink(QETProject *prj)
if (tmp_uuids_link.isEmpty()) return;
ElementProvider ep(prj);
foreach (Element *elmt, ep.fromUuids(tmp_uuids_link)) {
for (Element *elmt: ep.fromUuids(tmp_uuids_link)) {
elmt->linkToElement(this);
}
tmp_uuids_link.clear();
@@ -676,7 +676,7 @@ bool comparPos(const Element *elmt1, const Element *elmt2) {
void Element::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
QetGraphicsItem::mouseMoveEvent(event);
foreach (Terminal *t, terminals())
for (Terminal *t: terminals())
{
t -> drawHelpLine(true);
}
@@ -689,7 +689,7 @@ void Element::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
QetGraphicsItem::mouseReleaseEvent(event);
foreach (Terminal *t, terminals())
for (Terminal *t: terminals())
{
t -> drawHelpLine(false);
}
@@ -704,7 +704,7 @@ void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
Q_UNUSED(e);
foreach (Element *elmt, linkedElements())
for (Element *elmt: linkedElements())
elmt -> setHighlighted(true);
m_mouse_over = true;
@@ -721,7 +721,7 @@ void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) {
void Element::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) {
Q_UNUSED(e);
foreach (Element *elmt, linkedElements())
for (Element *elmt: linkedElements())
elmt -> setHighlighted(false);
m_mouse_over = false;

View File

@@ -210,7 +210,7 @@ void ElementTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
linked -> setSelected(true);
//Zoom to the linked element
foreach(QGraphicsView *view, linked -> diagram() -> views()) {
for (QGraphicsView *view: linked -> diagram() -> views()) {
QRectF fit = linked -> sceneBoundingRect();
fit.adjust(-200, -200, 200, 200);
view -> fitInView(fit, Qt::KeepAspectRatioByExpanding);
@@ -328,7 +328,7 @@ void ElementTextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
//Also color the child text if parent is a slave and linked
if (parent_element_-> linkType() == Element::Slave && !parent_element_ -> isFree())
foreach (QGraphicsItem *qgi, childItems())
for (QGraphicsItem *qgi: childItems())
if (QGraphicsTextItem *qgti = qgraphicsitem_cast<QGraphicsTextItem *> (qgi))
qgti -> setDefaultTextColor(Qt::blue);
}
@@ -364,7 +364,7 @@ void ElementTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
//Also color the child text if parent is a slave and linked
if (parent_element_-> linkType() == Element::Slave && !parent_element_ -> isFree())
foreach (QGraphicsItem *qgi, childItems())
for (QGraphicsItem *qgi: childItems())
if (QGraphicsTextItem *qgti = qgraphicsitem_cast<QGraphicsTextItem *> (qgi))
qgti -> setDefaultTextColor(Qt::black);
}

View File

@@ -58,7 +58,7 @@ bool GhostElement::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr,
terminalsFromXml(e, table_id_adr);
// instancie les champs de texte decrits dans l'element XML
foreach(QDomElement qde, QET::findInDomElement(e, "inputs", "input")) {
for (QDomElement qde: QET::findInDomElement(e, "inputs", "input")) {
qde.setAttribute("size", 9); // arbitraire
if (ElementTextItem *new_input = CustomElement::parseInput(qde)) {
new_input -> fromXml(qde);
@@ -116,7 +116,7 @@ QRectF GhostElement::minimalBoundingRect() const {
*/
bool GhostElement::terminalsFromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr) {
// instancie les bornes decrites dans l'element XML
foreach(QDomElement qde, QET::findInDomElement(e, "terminals", "terminal")) {
for (QDomElement qde: QET::findInDomElement(e, "terminals", "terminal")) {
if (!Terminal::valideXml(qde)) continue;
// modifie certains attributs pour que l'analyse par la classe CustomElement reussisse

View File

@@ -79,7 +79,7 @@ void MasterElement::unlinkAllElements()
// if this element is free no need to do something
if (!isFree())
{
foreach(Element *elmt, connected_elements)
for (Element *elmt: connected_elements)
unlinkElement(elmt);
emit linkedElementChanged();
}

View File

@@ -96,7 +96,7 @@ void QetGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *e)
{
//Disable views context menu
if (scene())
foreach (QGraphicsView *view, scene()->views())
for (QGraphicsView *view: scene()->views())
view->setContextMenuPolicy(Qt::NoContextMenu);
first_move_ = true;
@@ -164,6 +164,6 @@ void QetGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
//Enable views context menu
if (e -> button() == Qt::LeftButton)
if (scene())
foreach (QGraphicsView *view, scene()->views())
for (QGraphicsView *view: scene()->views())
view -> setContextMenuPolicy(Qt::DefaultContextMenu);
}

View File

@@ -259,7 +259,7 @@ QPainterPath QetShapeItem::shape() const
else
vector = m_polygon;
foreach(QRectF r, m_handler.handlerRect(vector))
for (QRectF r: m_handler.handlerRect(vector))
path.addRect(r);
}
@@ -562,7 +562,7 @@ bool QetShapeItem::fromXml(const QDomElement &e)
m_P2.setY(e.attribute("y2", 0).toDouble());
}
else
foreach(QDomElement de, QET::findInDomElement(e, "points", "point"))
for (QDomElement de: QET::findInDomElement(e, "points", "point"))
m_polygon << QPointF(de.attribute("x", 0).toDouble(), de.attribute("y", 0).toDouble());
return (true);
@@ -596,7 +596,7 @@ QDomElement QetShapeItem::toXml(QDomDocument &document) const
else
{
QDomElement points = document.createElement("points");
foreach(QPointF p, m_polygon)
for (QPointF p: m_polygon)
{
QDomElement point = document.createElement("point");
QPointF pf = mapToScene(p);

View File

@@ -122,7 +122,7 @@ void ReportElement::unlinkAllElements()
QList <Element *> tmp_elmt = connected_elements;
foreach(Element *elmt, connected_elements)
for (Element *elmt: connected_elements)
{
disconnect(elmt, SIGNAL(xChanged()), this, SLOT(updateLabel()));
disconnect(elmt, SIGNAL(yChanged()), this, SLOT(updateLabel()));
@@ -139,7 +139,7 @@ void ReportElement::unlinkAllElements()
}
updateLabel();
foreach(Element *elmt, tmp_elmt)
for (Element *elmt: tmp_elmt)
{
elmt -> setHighlighted(false);
elmt -> unlinkAllElements();

View File

@@ -83,7 +83,7 @@ void SlaveElement::unlinkAllElements()
// if this element is free no need to do something
if (!isFree())
{
foreach(Element *elmt, connected_elements)
for (Element *elmt: connected_elements)
unlinkElement(elmt);
emit linkedElementChanged();
}

View File

@@ -134,7 +134,7 @@ Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bo
associes.
*/
Terminal::~Terminal() {
foreach(Conductor *c, conductors_) delete c;
for (Conductor *c: conductors_) delete c;
delete br_;
}
@@ -194,7 +194,7 @@ bool Terminal::addConductor(Conductor *conductor)
Terminal *other_terminal = (conductor -> terminal1 == this) ? conductor->terminal2 : conductor->terminal1;
//Check if this terminal isn't already linked with other_terminal
foreach (Conductor* cond, conductors_)
for (Conductor* cond: conductors_)
if (cond -> terminal1 == other_terminal || cond -> terminal2 == other_terminal)
return false; //They already a conductor linked to this and other_terminal
@@ -418,14 +418,14 @@ Terminal* Terminal::alignedWithTerminal() const
QList <QGraphicsItem *> qgi_list = diagram() -> items(path);
//Remove all terminals of the parent element
foreach (Terminal *t, parent_element_ -> terminals())
for (Terminal *t: parent_element_ -> terminals())
qgi_list.removeAll(t);
if (qgi_list.isEmpty()) return nullptr;
//Get terminals only if orientation is opposed with this terminal
QList <Terminal *> available_terminals;
foreach (QGraphicsItem *qgi, qgi_list)
for (QGraphicsItem *qgi: qgi_list)
{
if (Terminal *tt = qgraphicsitem_cast <Terminal *> (qgi))
{
@@ -448,7 +448,7 @@ Terminal* Terminal::alignedWithTerminal() const
Terminal *nearest_terminal = available_terminals.takeFirst();
//Search the nearest terminal to this one
foreach (Terminal *terminal, available_terminals)
for (Terminal *terminal: available_terminals)
{
line.setP2(terminal -> dockConductor());
if (line.length() < current_lenght)
@@ -595,7 +595,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
{
use_properties = true;
others_properties = (*conductors_list.begin())->properties();
foreach (Conductor *conductor, conductors_list) {
for (Conductor *conductor: conductors_list) {
if (conductor->properties() != others_properties)
use_properties = false;
}
@@ -632,7 +632,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
* Update the path of conductor docked to this terminal
*/
void Terminal::updateConductor() {
foreach (Conductor *conductor, conductors_)
for (Conductor *conductor: conductors_)
conductor->updatePath();
}
@@ -644,7 +644,7 @@ bool Terminal::isLinkedTo(Terminal *other_terminal) {
if (other_terminal == this) return(false);
bool already_linked = false;
foreach (Conductor *c, conductors_) {
for (Conductor *c: conductors_) {
if (c -> terminal1 == other_terminal || c -> terminal2 == other_terminal) {
already_linked = true;
break;

View File

@@ -59,7 +59,7 @@ void QETMainWindow::initCommonActions() {
qet_app->configureQET();
//TODO we use reloadOldElementPanel only to keep up to date the string of the folio in the old element panel.
//then, if user change the option "Use labels of folio instead of their ID" the string of folio in the old element panel is up to date
foreach (QETDiagramEditor *qde, qet_app->diagramEditors())
for (QETDiagramEditor *qde: qet_app->diagramEditors())
qde->reloadOldElementPanel();
});

View File

@@ -408,7 +408,7 @@ void QETPrintPreviewDialog::updateZoomList() {
int current_zoom_index = -1;
zoom_box_ -> blockSignals(true);
zoom_box_ -> clear();
foreach (qreal z, zooms_real) {
for (qreal z: zooms_real) {
zoom_box_ -> addItem(QString(tr("%1 %")).arg(z * 100.0, 0, 'f', 2), z);
if (z == current_zoom) current_zoom_index = zoom_box_ -> count() - 1;
}

View File

@@ -737,7 +737,7 @@ QDomDocument QETProject::toXml() {
// titleblock templates, if any
if (titleblocks_.templates().count()) {
QDomElement titleblocktemplates_elmt = xml_doc.createElement("titleblocktemplates");
foreach (QString template_name, titleblocks_.templates()) {
for (QString template_name: titleblocks_.templates()) {
QDomElement e = titleblocks_.getTemplateXmlDescription(template_name);
titleblocktemplates_elmt.appendChild(xml_doc.importNode(e, true));
}
@@ -758,7 +758,7 @@ QDomDocument QETProject::toXml() {
// qDebug() << "Export XML de" << diagrams_.count() << "schemas";
int order_num = 1;
foreach(Diagram *diagram, diagrams_) {
for (Diagram *diagram: diagrams_) {
// Write the diagram to XML only if it is not of type DiagramFolioList.
DiagramFolioList *ptr = dynamic_cast<DiagramFolioList *>(diagram);
@@ -848,7 +848,7 @@ bool QETProject::isEmpty() const {
// compte le nombre de schemas non vides
int pertinent_diagrams = 0;
foreach(Diagram *diagram, diagrams_) {
for (Diagram *diagram: diagrams_) {
if (!diagram -> isEmpty()) ++ pertinent_diagrams;
}
@@ -988,7 +988,7 @@ QString QETProject::integrateTitleBlockTemplate(const TitleBlockTemplateLocation
*/
bool QETProject::usesElement(const ElementsLocation &location) const
{
foreach(Diagram *diagram, diagrams()) {
for (Diagram *diagram: diagrams()) {
if (diagram -> usesElement(location)) {
return(true);
}
@@ -1007,7 +1007,7 @@ QList<ElementsLocation> QETProject::unusedElements() const
{
QList <ElementsLocation> unused_list;
foreach(ElementsLocation location, m_elements_collection->elementsLocation())
for (ElementsLocation location: m_elements_collection->elementsLocation())
if (location.isElement() && !usesElement(location))
unused_list << location;
@@ -1023,7 +1023,7 @@ bool QETProject::usesTitleBlockTemplate(const TitleBlockTemplateLocation &locati
// a diagram can only use a title block template embedded wihtin its parent project
if (location.parentProject() != this) return(false);
foreach (Diagram *diagram, diagrams()) {
for (Diagram *diagram: diagrams()) {
if (diagram -> usesTitleBlockTemplate(location.name())) {
return(true);
}
@@ -1279,12 +1279,12 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
}
//Add the diagrams according to there "order" attribute
foreach(Diagram *diagram, loaded_diagrams.values())
for (Diagram *diagram: loaded_diagrams.values())
addDiagram(diagram);
//Initialise links between elements in this project
//and refresh the text of conductor
foreach (Diagram *d, diagrams())
for (Diagram *d: diagrams())
d->refreshContents();
delete dlgWaiting;
@@ -1323,7 +1323,7 @@ void QETProject::readElementsCollectionXml(QDomDocument &xml_project)
*/
void QETProject::readProjectPropertiesXml(QDomDocument &xml_project)
{
foreach (QDomElement e, QET::findInDomElement(xml_project.documentElement(), "properties"))
for (QDomElement e: QET::findInDomElement(xml_project.documentElement(), "properties"))
project_properties_.fromXml(e);
}
@@ -1381,7 +1381,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
if (!report_elmt.isNull()) setDefaultReportProperties(report_elmt.attribute("label"));
if (!xref_elmt.isNull())
{
foreach(QDomElement elmt, QET::findInDomElement(xref_elmt, "xref"))
for (QDomElement elmt: QET::findInDomElement(xref_elmt, "xref"))
{
XRefProperties xrp;
xrp.fromXml(elmt);
@@ -1392,7 +1392,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
{
m_current_conductor_autonum = conds_autonums.attribute("current_autonum");
m_freeze_new_conductors = conds_autonums.attribute("freeze_new_conductors") == "true";
foreach (QDomElement elmt, QET::findInDomElement(conds_autonums, "conductor_autonum"))
for (QDomElement elmt: QET::findInDomElement(conds_autonums, "conductor_autonum"))
{
NumerotationContext nc;
nc.fromXml(elmt);
@@ -1401,7 +1401,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
}
if (!folio_autonums.isNull())
{
foreach (QDomElement elmt, QET::findInDomElement(folio_autonums, "folio_autonum"))
for (QDomElement elmt: QET::findInDomElement(folio_autonums, "folio_autonum"))
{
NumerotationContext nc;
nc.fromXml(elmt);
@@ -1412,7 +1412,7 @@ void QETProject::readDefaultPropertiesXml(QDomDocument &xml_project)
{
m_current_element_autonum = element_autonums.attribute("current_autonum");
m_freeze_new_elements = element_autonums.attribute("freeze_new_elements") == "true";
foreach (QDomElement elmt, QET::findInDomElement(element_autonums, "element_autonum"))
for (QDomElement elmt: QET::findInDomElement(element_autonums, "element_autonum"))
{
NumerotationContext nc;
nc.fromXml(elmt);
@@ -1463,7 +1463,7 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
// export default XRef properties
QDomElement xrefs_elmt = xml_document.createElement("xrefs");
foreach (QString key, defaultXRefProperties().keys()) {
for (QString key: defaultXRefProperties().keys()) {
QDomElement xref_elmt = xml_document.createElement("xref");
xref_elmt.setAttribute("type", key);
defaultXRefProperties()[key].toXml(xref_elmt);
@@ -1475,7 +1475,7 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
QDomElement conductor_autonums = xml_document.createElement("conductors_autonums");
conductor_autonums.setAttribute("current_autonum", m_current_conductor_autonum);
conductor_autonums.setAttribute("freeze_new_conductors", m_freeze_new_conductors ? "true" : "false");
foreach (QString key, conductorAutoNum().keys()) {
for (QString key: conductorAutoNum().keys()) {
QDomElement conductor_autonum = conductorAutoNum(key).toXml(xml_document, "conductor_autonum");
if (key != "" && conductorAutoNumFormula(key) != "") {
conductor_autonum.setAttribute("title", key);
@@ -1487,7 +1487,7 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
//Export Folio Autonums
QDomElement folio_autonums = xml_document.createElement("folio_autonums");
foreach (QString key, folioAutoNum().keys()) {
for (QString key: folioAutoNum().keys()) {
QDomElement folio_autonum = folioAutoNum(key).toXml(xml_document, "folio_autonum");
folio_autonum.setAttribute("title", key);
folio_autonums.appendChild(folio_autonum);
@@ -1498,7 +1498,7 @@ void QETProject::writeDefaultPropertiesXml(QDomElement &xml_element) {
QDomElement element_autonums = xml_document.createElement("element_autonums");
element_autonums.setAttribute("current_autonum", m_current_element_autonum);
element_autonums.setAttribute("freeze_new_elements", m_freeze_new_elements ? "true" : "false");
foreach (QString key, elementAutoNum().keys()) {
for (QString key: elementAutoNum().keys()) {
QDomElement element_autonum = elementAutoNum(key).toXml(xml_document, "element_autonum");
if (key != "" && elementAutoNumFormula(key) != "") {
element_autonum.setAttribute("title", key);
@@ -1652,7 +1652,7 @@ void QETProject::updateDiagramsFolioData() {
void QETProject::updateDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection *collection, const QString &template_name) {
Q_UNUSED(collection)
foreach (Diagram *diagram, diagrams_) {
for (Diagram *diagram: diagrams_) {
diagram -> titleBlockTemplateChanged(template_name);
}
}
@@ -1666,7 +1666,7 @@ void QETProject::removeDiagramsTitleBlockTemplate(TitleBlockTemplatesCollection
Q_UNUSED(collection)
// warn diagrams that the given template is about to be removed
foreach (Diagram *diagram, diagrams_) {
for (Diagram *diagram: diagrams_) {
diagram -> titleBlockTemplateRemoved(template_name);
}
}

View File

@@ -36,7 +36,7 @@ QGIManager::QGIManager(QGraphicsScene *sc) :
*/
QGIManager::~QGIManager(){
if (!destroy_qgi_on_delete) return;
foreach(QGraphicsItem *qgi, qgi_manager.keys()) {
for (QGraphicsItem *qgi: qgi_manager.keys()) {
if (!scene -> items().contains(qgi)) delete qgi;
}
}
@@ -71,7 +71,7 @@ void QGIManager::release(QGraphicsItem *qgi) {
@param qgis QGraphicsItems a gerer
*/
void QGIManager::manage(const QList<QGraphicsItem *> &qgis) {
foreach(QGraphicsItem *qgi, qgis) manage(qgi);
for (QGraphicsItem *qgi: qgis) manage(qgi);
}
/**
@@ -82,7 +82,7 @@ void QGIManager::manage(const QList<QGraphicsItem *> &qgis) {
@param qgis QGraphicsItems a ne plus gerer
*/
void QGIManager::release(const QList<QGraphicsItem *> &qgis) {
foreach(QGraphicsItem *qgi, qgis) release(qgi);
for (QGraphicsItem *qgi: qgis) release(qgi);
}
/**

View File

@@ -82,7 +82,7 @@ void QTextOrientationWidget::setFont(const QFont &font) {
text_font_ = font;
// invalide le cache contenant les longueurs des textes a disposition
foreach(QString text, text_size_hash_.keys()) {
for (QString text: text_size_hash_.keys()) {
text_size_hash_[text] = -1;
}
}
@@ -119,7 +119,7 @@ void QTextOrientationWidget::setUsableTexts(const QStringList &texts_list) {
if (texts_list.isEmpty()) return;
// on oublie les anciennes chaines
foreach(QString text, text_size_hash_.keys()) {
for (QString text: text_size_hash_.keys()) {
// il faut oublier les anciennes chaines
if (!texts_list.contains(text)) {
text_size_hash_.remove(text);
@@ -127,7 +127,7 @@ void QTextOrientationWidget::setUsableTexts(const QStringList &texts_list) {
}
// on ajoute les nouvelles, sans les calculer (on met -1 en guise de longueur)
foreach(QString text, texts_list) {
for (QString text: texts_list) {
if (!text_size_hash_.contains(text)) {
text_size_hash_[text] = -1;
}
@@ -306,7 +306,7 @@ QString QTextOrientationWidget::getMostUsableStringForRadius(const qreal &radius
*/
void QTextOrientationWidget::generateTextSizeHash() {
QFontMetrics font_metrics(text_font_);
foreach(QString text, text_size_hash_.keys()) {
for (QString text: text_size_hash_.keys()) {
if (text_size_hash_[text] == -1) {
text_size_hash_[text] = font_metrics.boundingRect(text).width();
}

View File

@@ -173,7 +173,7 @@ void RecentFiles::buildMenu() {
}
// remplit le menu
foreach (QString filepath, list_) {
for (QString filepath: list_) {
// creee une nouvelle action pour le fichier
QAction *action = new QAction(filepath, this);
if (!files_icon_.isNull()) {

View File

@@ -440,7 +440,7 @@ RichTextEditorToolBar::RichTextEditorToolBar(RichTextEditor *editor,
// Font size combo box
m_font_size_input->setEditable(false);
const QList<int> font_sizes = QFontDatabase::standardSizes();
foreach (int font_size, font_sizes)
for (int font_size: font_sizes)
m_font_size_input->addItem(QString::number(font_size));
connect(m_font_size_input, SIGNAL(activated(QString)),

View File

@@ -137,7 +137,7 @@ void HelperCell::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
if (actions_.isEmpty()) return;
QMenu context_menu;
foreach (QAction *action, actions_) {
for (QAction *action: actions_) {
context_menu.addAction(action);
}
emit(contextMenuTriggered(this));

View File

@@ -50,7 +50,7 @@ TitleBlockTemplateCellsSet::~TitleBlockTemplateCellsSet() {
*/
QPainterPath TitleBlockTemplateCellsSet::painterPath() const {
QPainterPath cells_path;
foreach (TitleBlockTemplateVisualCell *cell, *this) {
for (TitleBlockTemplateVisualCell *cell: *this) {
cells_path.addRect(cell -> geometry());
}
return(cells_path);
@@ -74,7 +74,7 @@ bool TitleBlockTemplateCellsSet::isRectangle() const {
@return true if all cells within this set are selected
*/
bool TitleBlockTemplateCellsSet::allCellsAreSelected() const {
foreach (TitleBlockTemplateVisualCell *cell, *this) {
for (TitleBlockTemplateVisualCell *cell: *this) {
if (!cell -> isSelected()) {
return(false);
}
@@ -91,7 +91,7 @@ bool TitleBlockTemplateCellsSet::hasExternalSpan() const {
QSet<TitleBlockCell *> all_cells = cells(true);
// look for cells spanned by cells that do not belong to this set
foreach (TitleBlockCell *cell, all_cells) {
for (TitleBlockCell *cell: all_cells) {
if (cell -> spanner_cell && !all_cells.contains(cell -> spanner_cell)) {
return(true);
}
@@ -108,7 +108,7 @@ TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::topLeftCell() const {
// look for cells at the top
QMultiMap<int, TitleBlockTemplateVisualCell *> top_cells;
foreach (TitleBlockTemplateVisualCell *cell_view, *this) {
for (TitleBlockTemplateVisualCell *cell_view: *this) {
if (TitleBlockCell *cell = cell_view -> cell()) {
top_cells.insertMulti(cell -> num_row, cell_view);
}
@@ -119,7 +119,7 @@ TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::topLeftCell() const {
// look for the cell at the left
int lowest_num_col = 100000;
TitleBlockTemplateVisualCell *candidate = 0;
foreach (TitleBlockTemplateVisualCell *cell_view, candidates) {
for (TitleBlockTemplateVisualCell *cell_view: candidates) {
if (TitleBlockCell *cell = cell_view -> cell()) {
if (cell -> num_col < lowest_num_col) {
lowest_num_col = cell -> num_col;
@@ -139,7 +139,7 @@ TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::bottomRightCell() cons
// look for cells at the bottom
QMultiMap<qreal, TitleBlockTemplateVisualCell *> bottom_cells;
foreach (TitleBlockTemplateVisualCell *cell_view, *this) {
for (TitleBlockTemplateVisualCell *cell_view: *this) {
bottom_cells.insertMulti(cell_view -> geometry().bottom(), cell_view);
}
QList<TitleBlockTemplateVisualCell *> candidates = bottom_cells.values(bottom_cells.keys().last());
@@ -148,7 +148,7 @@ TitleBlockTemplateVisualCell *TitleBlockTemplateCellsSet::bottomRightCell() cons
// look for the cell at the right
qreal highest_right = -100000;
TitleBlockTemplateVisualCell *candidate = 0;
foreach (TitleBlockTemplateVisualCell *cell_view, candidates) {
for (TitleBlockTemplateVisualCell *cell_view: candidates) {
qreal right = cell_view -> geometry().right();
if (right > highest_right) {
highest_right = right;
@@ -197,10 +197,10 @@ TitleBlockTemplateCellsSet TitleBlockTemplateCellsSet::mergeArea(const QRectF &r
*/
QSet<TitleBlockCell *> TitleBlockTemplateCellsSet::cells(bool include_spanned) const {
QSet<TitleBlockCell *> set;
foreach (TitleBlockTemplateVisualCell *cell_view, *this) {
for (TitleBlockTemplateVisualCell *cell_view: *this) {
if (TitleBlockCell *cell = cell_view -> cell()) {
if (include_spanned) {
foreach (TitleBlockCell *cell, cell_view -> cells()) {
for (TitleBlockCell *cell: cell_view -> cells()) {
set << cell;
}
} else {

View File

@@ -308,7 +308,7 @@ void TitleBlockTemplateCellWidget::updateLogosComboBox(const TitleBlockTemplate
logo_input_ -> setCurrentIndex(0);
if (!parent_template) return;
foreach (QString logo, parent_template -> logos()) {
for (QString logo: parent_template -> logos()) {
logo_input_ -> addItem(logo, QVariant(logo));
}
int current_value_index = logo_input_ -> findData(current_value);

View File

@@ -72,7 +72,7 @@ bool ModifyTitleBlockCellCommand::mergeWith(const QUndoCommand *command) {
*/
void ModifyTitleBlockCellCommand::undo() {
if (!modified_cell_) return;
foreach (QString attribute, old_values_.keys()) {
for (QString attribute: old_values_.keys()) {
modified_cell_ -> setAttribute(attribute, old_values_[attribute]);
}
if (view_) view_ -> refresh();
@@ -83,7 +83,7 @@ void ModifyTitleBlockCellCommand::undo() {
*/
void ModifyTitleBlockCellCommand::redo() {
if (!modified_cell_) return;
foreach (QString attribute, new_values_.keys()) {
for (QString attribute: new_values_.keys()) {
modified_cell_ -> setAttribute(attribute, new_values_[attribute]);
}
if (view_) view_ -> refresh();
@@ -601,7 +601,7 @@ MergeCellsCommand::MergeCellsCommand(const TitleBlockTemplateCellsSet &merged_ce
if (!spanning_cell_) return;
// store the spanner_cell attribute of each cell implied in the merge
foreach(TitleBlockCell *cell, merged_cells.cells()) {
for (TitleBlockCell *cell: merged_cells.cells()) {
spanner_cells_before_merge_.insert(cell, cell -> spanner_cell);
}
@@ -670,7 +670,7 @@ void MergeCellsCommand::undo() {
if (!isValid()) return;
// restore the original spanning_cell attribute of all impacted cells
foreach (TitleBlockCell *cell, spanner_cells_before_merge_.keys()) {
for (TitleBlockCell *cell: spanner_cells_before_merge_.keys()) {
cell -> spanner_cell = spanner_cells_before_merge_[cell];
}
@@ -691,7 +691,7 @@ void MergeCellsCommand::redo() {
if (!isValid()) return;
// set the spanning_cell attributes of spanned cells to the spanning cell
foreach (TitleBlockCell *cell, spanner_cells_before_merge_.keys()) {
for (TitleBlockCell *cell: spanner_cells_before_merge_.keys()) {
if (cell == spanning_cell_) continue;
cell -> spanner_cell = spanning_cell_;
}
@@ -723,7 +723,7 @@ TitleBlockCell *MergeCellsCommand::getBottomRightCell(const TitleBlockTemplateCe
// we then look for the bottom right logical cell
int max_num_row = -1, max_num_col = -1;
TitleBlockCell *candidate = 0;
foreach(TitleBlockCell *cell, logical_cells) {
for (TitleBlockCell *cell: logical_cells) {
if (cell -> num_row > max_num_row) max_num_row = cell -> num_row;
if (cell -> num_col > max_num_col) max_num_col = cell -> num_col;
if (cell -> num_row == max_num_row && cell -> num_col == max_num_col) {
@@ -810,7 +810,7 @@ void SplitCellsCommand::undo() {
if (!isValid()) return;
// the spanned cells are spanned again
foreach(TitleBlockCell *cell, spanned_cells_) {
for (TitleBlockCell *cell: spanned_cells_) {
cell -> spanner_cell = spanning_cell_;
}
@@ -831,7 +831,7 @@ void SplitCellsCommand::redo() {
if (!isValid()) return;
// the spanned cells are not spanned anymore
foreach(TitleBlockCell *cell, spanned_cells_) {
for (TitleBlockCell *cell: spanned_cells_) {
cell -> spanner_cell = 0;
}
@@ -898,7 +898,7 @@ CutTemplateCellsCommand::~CutTemplateCellsCommand() {
Undo a cut operation
*/
void CutTemplateCellsCommand::undo() {
foreach (TitleBlockCell *cell, cut_cells_.keys()) {
for (TitleBlockCell *cell: cut_cells_.keys()) {
cell -> cell_type = cut_cells_.value(cell);
}
refreshView();
@@ -908,14 +908,14 @@ void CutTemplateCellsCommand::undo() {
Redo a cut operation
*/
void CutTemplateCellsCommand::redo() {
foreach (TitleBlockCell *cell, cut_cells_.keys()) {
for (TitleBlockCell *cell: cut_cells_.keys()) {
cell -> cell_type = TitleBlockCell::EmptyCell;
}
refreshView();
}
void CutTemplateCellsCommand::setCutCells(const QList<TitleBlockCell *> &cells) {
foreach (TitleBlockCell *cell, cells) {
for (TitleBlockCell *cell: cells) {
cut_cells_.insert(cell, cell -> cell_type);
}
updateText();
@@ -957,7 +957,7 @@ void PasteTemplateCellsCommand::updateText() {
*/
void PasteTemplateCellsCommand::undo() {
bool span_management = erased_cells_.count() > 1;
foreach (TitleBlockCell *cell, erased_cells_.keys()) {
for (TitleBlockCell *cell: erased_cells_.keys()) {
cell -> loadContentFromCell(erased_cells_.value(cell));
}
if (span_management) {
@@ -987,7 +987,7 @@ void PasteTemplateCellsCommand::redo() {
}
// copy data from each pasted cell into each erased cell
foreach (TitleBlockCell *cell, erased_cells_.keys()) {
for (TitleBlockCell *cell: erased_cells_.keys()) {
if (span_management) {
// the erased cell may be spanned by another cell
if (TitleBlockCell *spanning_cell = cell -> spanner_cell) {
@@ -1012,7 +1012,7 @@ void PasteTemplateCellsCommand::redo() {
if (cell -> row_span || cell -> col_span) {
// browse newly spanned cells...
foreach (TitleBlockCell *spanned_cell, tbtemplate_ -> spannedCells(cell, true)) {
for (TitleBlockCell *spanned_cell: tbtemplate_ -> spannedCells(cell, true)) {
// ... to ensure they are not already spanned by other cells
if (spanned_cell -> spanner_cell && spanned_cell -> spanner_cell != cell) {
// if so, simply cancel the whole spanning

View File

@@ -116,7 +116,7 @@ void TitleBlockTemplateLocationChooser::updateCollections() {
collections_index_.clear();
int index = 0;
foreach(TitleBlockTemplatesCollection *collection, QETApp::availableTitleBlockTemplatesCollections()) {
for (TitleBlockTemplatesCollection *collection: QETApp::availableTitleBlockTemplatesCollections()) {
collections_ -> addItem(collection -> title());
collections_index_.insert(index, collection);
++ index;
@@ -136,7 +136,7 @@ void TitleBlockTemplateLocationChooser::updateTemplates() {
QStringList available_templates = current_collection -> templates();
if (available_templates.count()) {
foreach (QString template_name, available_templates) {
for (QString template_name: available_templates) {
templates_ -> addItem(template_name, QVariant(true));
}
}

View File

@@ -137,7 +137,7 @@ void TitleBlockTemplateLogoManager::fillView() {
if (!managed_template_) return;
logos_view_ -> clear();
foreach (QString logo_name, managed_template_ -> logos()) {
for (QString logo_name: managed_template_ -> logos()) {
QIcon current_icon;
QPixmap current_logo = managed_template_ -> bitmapLogo(logo_name);
if (!current_logo.isNull()) {

View File

@@ -98,7 +98,7 @@ QETProject *TitleBlockTemplatesCollection::parentProject() {
*/
QList<TitleBlockTemplateLocation> TitleBlockTemplatesCollection::templatesLocations() {
QList<TitleBlockTemplateLocation> locations;
foreach (QString template_name, templates()) {
for (QString template_name: templates()) {
locations << location(template_name);
}
return(locations);
@@ -320,7 +320,7 @@ bool TitleBlockTemplatesProjectCollection::isReadOnly(const QString &template_na
@param xml_element XML element to be parsed to load title block templates
*/
void TitleBlockTemplatesProjectCollection::fromXml(const QDomElement &xml_element) {
foreach (QDomElement e, QET::findInDomElement(xml_element, "titleblocktemplates", "titleblocktemplate")) {
for (QDomElement e: QET::findInDomElement(xml_element, "titleblocktemplates", "titleblocktemplate")) {
// each titleblock template must have a name
if (!e.hasAttribute("name")) continue;
QString titleblock_template_name = e.attribute("name");
@@ -340,7 +340,7 @@ void TitleBlockTemplatesProjectCollection::fromXml(const QDomElement &xml_elemen
void TitleBlockTemplatesProjectCollection::deleteUnusedTitleBlocKTemplates() {
if (!project_) return;
foreach (QString template_name, templates()) {
for (QString template_name: templates()) {
if (!project_ -> usesTitleBlockTemplate(location(template_name))) {
removeTemplate(template_name);
}
@@ -390,7 +390,7 @@ QString TitleBlockTemplatesFilesCollection::path(const QString &template_name) c
QStringList TitleBlockTemplatesFilesCollection::templates() {
QStringList templates_names;
QRegExp replace_regexp(QString("%1$").arg(TITLEBLOCKS_FILE_EXTENSION));
foreach(QString name, dir_.entryList()) {
for (QString name: dir_.entryList()) {
templates_names << name.replace(replace_regexp, "");
}
return(templates_names);

View File

@@ -158,7 +158,7 @@ QList<TitleBlockCell *> TitleBlockTemplateView::copy() {
QDomDocument xml_export;
QDomElement tbtpartial = xml_export.createElement("titleblocktemplate-partial");
xml_export.appendChild(tbtpartial);
foreach (TitleBlockCell *cell, copied_cells) {
for (TitleBlockCell *cell: copied_cells) {
tbtemplate_ -> exportCellToXml(cell, tbtpartial);
tbtpartial.setAttribute("row", cell -> num_row);
tbtpartial.setAttribute("col", cell -> num_col);
@@ -248,7 +248,7 @@ void TitleBlockTemplateView::paste() {
normalizeCells(pasted_cells, erased_cell -> num_row, erased_cell -> num_col);
PasteTemplateCellsCommand *paste_command = new PasteTemplateCellsCommand(tbtemplate_);
foreach (TitleBlockCell cell, pasted_cells) {
for (TitleBlockCell cell: pasted_cells) {
TitleBlockCell *erased_cell = tbtemplate_ -> cell(cell.num_row, cell.num_col);
if (!erased_cell) continue;
paste_command -> addCell(erased_cell, *erased_cell, cell);
@@ -1056,7 +1056,7 @@ void TitleBlockTemplateView::removeItem(QGraphicsLayoutItem *item) {
*/
TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems(const QList<QGraphicsItem *> &items) const {
TitleBlockTemplateCellsSet set(this);
foreach (QGraphicsItem *item, items) {
for (QGraphicsItem *item: items) {
if (TitleBlockTemplateVisualCell *cell_view = dynamic_cast<TitleBlockTemplateVisualCell *>(item)) {
if (cell_view -> cell() && cell_view -> cell() -> num_row != -1) {
set << cell_view;

View File

@@ -125,7 +125,7 @@ void TitleBlockProperties::fromXml(const QDomElement &e) {
// reads the additional fields used to fill the title block
context.clear();
foreach (QDomElement e, QET::findInDomElement(e, "properties")) {
for (QDomElement e: QET::findInDomElement(e, "properties")) {
context.fromXml(e);
}
}

View File

@@ -172,7 +172,7 @@ TitleBlockTemplate *TitleBlockTemplate::clone() const {
copy -> information_ = information_;
// this does not really duplicates pixmaps, only the objects that hold a key to the implicitly shared pixmaps
foreach (QString logo_key, bitmap_logos_.keys()) {
for (QString logo_key: bitmap_logos_.keys()) {
copy -> bitmap_logos_[logo_key] = QPixmap(bitmap_logos_[logo_key]);
#ifdef TITLEBLOCK_TEMPLATE_DEBUG
qDebug() << Q_FUNC_INFO << "copying " << bitmap_logos_[logo_key] -> cacheKey() << "to" << copy -> bitmap_logos_[logo_key] -> cacheKey();
@@ -180,7 +180,7 @@ TitleBlockTemplate *TitleBlockTemplate::clone() const {
}
// we have to create new QSvgRenderer objects from the data (no copy constructor)
foreach (QString logo_key, vector_logos_.keys()) {
for (QString logo_key: vector_logos_.keys()) {
copy -> vector_logos_[logo_key] = new QSvgRenderer(data_logos_[logo_key]);
}
@@ -336,7 +336,7 @@ void TitleBlockTemplate::parseRows(const QString &rows_string) {
bool conv_ok;
QStringList rows_descriptions = rows_string.split(QChar(';'), QString::SkipEmptyParts);
foreach (QString rows_description, rows_descriptions) {
for (QString rows_description: rows_descriptions) {
if (row_size_format.exactMatch(rows_description)) {
int row_size = row_size_format.capturedTexts().at(1).toInt(&conv_ok);
if (conv_ok) rows_heights_ << row_size;
@@ -359,7 +359,7 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) {
bool conv_ok;
QStringList cols_descriptions = cols_string.split(QChar(';'), QString::SkipEmptyParts);
foreach (QString cols_description, cols_descriptions) {
for (QString cols_description: cols_descriptions) {
if (abs_col_size_format.exactMatch(cols_description)) {
int col_size = abs_col_size_format.capturedTexts().at(1).toInt(&conv_ok);
if (conv_ok) columns_width_ << TitleBlockDimension(col_size, QET::Absolute);
@@ -370,7 +370,7 @@ void TitleBlockTemplate::parseColumns(const QString &cols_string) {
}
}
#ifdef TITLEBLOCK_TEMPLATE_DEBUG
foreach (TitleBlockColDimension icd, columns_width_) {
for (TitleBlockColDimension icd, columns_width_) {
qDebug() << Q_FUNC_INFO << QString("%1 [%2]").arg(icd.value).arg(QET::titleBlockColumnLengthToString(icd.type));
}
#endif
@@ -423,7 +423,7 @@ void TitleBlockTemplate::saveInformation(QDomElement &xml_element) const {
*/
void TitleBlockTemplate::saveLogos(QDomElement &xml_element) const {
QDomElement logos_element = xml_element.ownerDocument().createElement("logos");
foreach(QString logo_name, type_logos_.keys()) {
for (QString logo_name: type_logos_.keys()) {
QDomElement logo_element = xml_element.ownerDocument().createElement("logo");
saveLogo(logo_name, logo_element);
logos_element.appendChild(logo_element);
@@ -462,8 +462,8 @@ void TitleBlockTemplate::saveGrid(QDomElement &xml_element) const {
QDomElement grid_element = xml_element.ownerDocument().createElement("grid");
QString rows_attr, cols_attr;
foreach(int row_height, rows_heights_) rows_attr += QString("%1;").arg(row_height);
foreach(TitleBlockDimension col_width, columns_width_) cols_attr += col_width.toShortString();
for (int row_height: rows_heights_) rows_attr += QString("%1;").arg(row_height);
for (TitleBlockDimension col_width: columns_width_) cols_attr += col_width.toShortString();
grid_element.setAttribute("rows", rows_attr);
grid_element.setAttribute("cols", cols_attr);
@@ -719,7 +719,7 @@ QList<int> TitleBlockTemplate::columnsWidth(int total_width) const {
int share = difference > 0 ? 1 : -1;
if (qAbs(difference) <= max_acceptable_difference) {
while (difference) {
foreach (int index, relative_columns) {
for (int index: relative_columns) {
final_widths[index] += share;
difference -= share;
if (!difference) break;
@@ -807,7 +807,7 @@ int TitleBlockTemplate::maximumWidth() {
*/
int TitleBlockTemplate::width(int total_width) {
int width = 0;
foreach (int col_width, columnsWidth(total_width)) {
for (int col_width: columnsWidth(total_width)) {
width += col_width;
}
return(width);
@@ -818,7 +818,7 @@ int TitleBlockTemplate::width(int total_width) {
*/
int TitleBlockTemplate::height() const {
int height = 0;
foreach(int row_height, rows_heights_) {
for (int row_height: rows_heights_) {
height += row_height;
}
return(height);
@@ -1011,7 +1011,7 @@ QHash<TitleBlockCell *, QPair<int, int> > TitleBlockTemplate::getAllSpans() cons
Restore a set of span parameters.
*/
void TitleBlockTemplate::setAllSpans(const QHash<TitleBlockCell *, QPair<int, int> > &spans) {
foreach (TitleBlockCell *cell, spans.keys()) {
for (TitleBlockCell *cell: spans.keys()) {
cell -> row_span = spans[cell].first;
cell -> col_span = spans[cell].second;
}
@@ -1362,7 +1362,7 @@ QString TitleBlockTemplate::finalTextForCell(const TitleBlockCell &cell, const D
*/
QString TitleBlockTemplate::interpreteVariables(const QString &string, const DiagramContext &diagram_context) const {
QString interpreted_string = string;
foreach (QString key, diagram_context.keys(DiagramContext::DecreasingLength)) {
for (QString key: diagram_context.keys(DiagramContext::DecreasingLength)) {
interpreted_string.replace("%{" + key + "}", diagram_context[key].toString());
interpreted_string.replace("%" + key, diagram_context[key].toString());
}
@@ -1505,7 +1505,7 @@ void TitleBlockTemplate::forgetSpanning() {
*/
void TitleBlockTemplate::forgetSpanning(TitleBlockCell *spanning_cell, bool modify_cell) {
if (!spanning_cell) return;
foreach (TitleBlockCell *spanned_cell, spannedCells(spanning_cell)) {
for (TitleBlockCell *spanned_cell: spannedCells(spanning_cell)) {
spanned_cell -> spanner_cell = 0;
}
if (modify_cell) {

View File

@@ -74,7 +74,7 @@ void ConductorPropertiesDialog::PropertiesDialog(Conductor *conductor, QWidget *
{
undo->setText(tr("Modifier les propriétés de plusieurs conducteurs", "undo caption"));
foreach (Conductor *potential_conductor, conductor->relatedPotentialConductors())
for (Conductor *potential_conductor: conductor->relatedPotentialConductors())
{
old_value.setValue(potential_conductor->properties());
new QPropertyUndoCommand (potential_conductor, "properties", old_value, new_value, undo);

View File

@@ -125,7 +125,7 @@ void DiagramPropertiesEditorDockWidget::selectionChanged()
clear();
}
foreach (PropertiesEditorWidget *pew, editors())
for (PropertiesEditorWidget *pew: editors())
pew->setLiveEdit(true);
}

View File

@@ -157,7 +157,7 @@ bool ElementInfoWidget::event(QEvent *event)
*/
void ElementInfoWidget::enableLiveEdit()
{
foreach (ElementInfoPartWidget *eipw, m_eipw_list)
for (ElementInfoPartWidget *eipw: m_eipw_list)
{
connect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
connect(eipw, &ElementInfoPartWidget::showClicked, this, &ElementInfoWidget::apply);
@@ -170,7 +170,7 @@ void ElementInfoWidget::enableLiveEdit()
*/
void ElementInfoWidget::disableLiveEdit()
{
foreach (ElementInfoPartWidget *eipw, m_eipw_list)
for (ElementInfoPartWidget *eipw: m_eipw_list)
{
disconnect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
disconnect(eipw, &ElementInfoPartWidget::showClicked, this, &ElementInfoWidget::apply);
@@ -183,7 +183,7 @@ void ElementInfoWidget::disableLiveEdit()
*/
void ElementInfoWidget::buildInterface()
{
foreach (QString str, QETApp::elementInfoKeys())
for (QString str: QETApp::elementInfoKeys())
{
ElementInfoPartWidget *eipw = new ElementInfoPartWidget(str, QETApp::elementTranslatedInfoKey(str), this);
ui->scroll_vlayout->addWidget(eipw);
@@ -199,7 +199,7 @@ void ElementInfoWidget::buildInterface()
*/
ElementInfoPartWidget *ElementInfoWidget::infoPartWidgetForKey(const QString &key) const
{
foreach (ElementInfoPartWidget *eipw, m_eipw_list)
for (ElementInfoPartWidget *eipw: m_eipw_list)
{
if (eipw->key() == key)
return eipw;
@@ -219,7 +219,7 @@ void ElementInfoWidget::updateUi()
if (m_live_edit) disableLiveEdit();
DiagramContext element_info = m_element->elementInformations();
foreach (ElementInfoPartWidget *eipw, m_eipw_list)
for (ElementInfoPartWidget *eipw: m_eipw_list)
{
eipw -> setText (element_info[eipw->key()].toString());
@@ -246,7 +246,7 @@ DiagramContext ElementInfoWidget::currentInfo() const
{
DiagramContext info_;
foreach (ElementInfoPartWidget *eipw, m_eipw_list)
for (ElementInfoPartWidget *eipw: m_eipw_list)
if (!eipw->text().isEmpty()) //add value only if they're something to store
info_.addValue(eipw->key(), eipw->text(), eipw->mustShow());

View File

@@ -61,7 +61,7 @@ void ElementPropertiesWidget::setElement(Element *element)
//If previous element is same type as new element we just call setElement for each editor
if(previous_element->linkType() == m_element->linkType())
{
foreach (AbstractElementPropertiesEditorWidget *aepew, m_list_editor)
for (AbstractElementPropertiesEditorWidget *aepew: m_list_editor)
{
aepew->setElement(m_element);
addGeneralWidget();
@@ -81,21 +81,21 @@ void ElementPropertiesWidget::apply()
{
QList <QUndoCommand *> undo_list;
foreach (PropertiesEditorWidget *pew, m_list_editor)
for (PropertiesEditorWidget *pew: m_list_editor)
if (QUndoCommand *undo = pew->associatedUndo())
undo_list << undo;
if (undo_list.isEmpty()) return;
QString str;
foreach(QUndoCommand *uc, undo_list) str += uc->text() += " ";
for (QUndoCommand *uc: undo_list) str += uc->text() += " ";
QUndoStack &stack = m_element -> diagram() -> undoStack();
stack.beginMacro(str);
foreach(QUndoCommand *uc, undo_list) stack.push(uc);
for (QUndoCommand *uc: undo_list) stack.push(uc);
stack.endMacro();
foreach(PropertiesEditorWidget *pew, m_list_editor)
for (PropertiesEditorWidget *pew: m_list_editor)
pew->updateUi();
}
@@ -104,7 +104,7 @@ void ElementPropertiesWidget::apply()
* Reset the edited properties
*/
void ElementPropertiesWidget::reset() {
foreach (PropertiesEditorWidget *pew, m_list_editor) pew->reset();
for (PropertiesEditorWidget *pew: m_list_editor) pew->reset();
}
bool ElementPropertiesWidget::setLiveEdit(bool live_edit)
@@ -112,7 +112,7 @@ bool ElementPropertiesWidget::setLiveEdit(bool live_edit)
if (m_live_edit == live_edit) return true;
m_live_edit = live_edit;
foreach (AbstractElementPropertiesEditorWidget *aepew, m_list_editor)
for (AbstractElementPropertiesEditorWidget *aepew: m_list_editor)
aepew->setLiveEdit(m_live_edit);
return true;
@@ -205,7 +205,7 @@ void ElementPropertiesWidget::updateUi()
}
//Add each editors in tab widget
foreach (AbstractElementPropertiesEditorWidget *aepew, m_list_editor)
for (AbstractElementPropertiesEditorWidget *aepew: m_list_editor)
{
aepew->setLiveEdit(m_live_edit);
m_tab->addTab(aepew, aepew->title());

View File

@@ -211,7 +211,7 @@ void LinkSingleElementWidget::buildTree()
if (m_element->linkType() == Element::Slave)
{
foreach(Element *elmt, availableElements())
for (Element *elmt: availableElements())
{
QStringList search_list;
QStringList str_list;
@@ -255,7 +255,7 @@ void LinkSingleElementWidget::buildTree()
else if (m_element->linkType() & Element::AllReport)
{
foreach(Element *elmt, availableElements())
for (Element *elmt: availableElements())
{
QStringList search_list;
QStringList str_list;
@@ -362,7 +362,7 @@ void LinkSingleElementWidget::setUpCompleter()
delete ui->m_search_field->completer();
QStringList search;
foreach(QStringList strl , m_qtwi_strl_hash.values())
for (QStringList strl: m_qtwi_strl_hash.values())
search.append(strl);
QCompleter *c = new QCompleter(search, ui->m_search_field);
@@ -385,7 +385,7 @@ void LinkSingleElementWidget::clearTreeWidget()
delete qtwi;
}
foreach(QTreeWidgetItem *qtwi, m_qtwi_elmt_hash.keys())
for (QTreeWidgetItem *qtwi: m_qtwi_elmt_hash.keys())
delete qtwi;
m_qtwi_elmt_hash.clear();
@@ -589,14 +589,14 @@ void LinkSingleElementWidget::on_m_show_this_pb_clicked()
void LinkSingleElementWidget::on_m_search_field_textEdited(const QString &arg1)
{
//Show all items if arg1 is empty, if not hide all items
foreach(QTreeWidgetItem *qtwi, m_qtwi_elmt_hash.keys())
for (QTreeWidgetItem *qtwi: m_qtwi_elmt_hash.keys())
qtwi->setHidden(!arg1.isEmpty());
QList <QTreeWidgetItem *> qtwi_list;
foreach(QTreeWidgetItem *qtwi, m_qtwi_strl_hash.keys())
for (QTreeWidgetItem *qtwi: m_qtwi_strl_hash.keys())
{
foreach(QString str, m_qtwi_strl_hash.value(qtwi))
for (QString str: m_qtwi_strl_hash.value(qtwi))
{
if(str.contains(arg1, Qt::CaseInsensitive))
{
@@ -607,6 +607,6 @@ void LinkSingleElementWidget::on_m_search_field_textEdited(const QString &arg1)
}
//Show items which match with arg1
foreach(QTreeWidgetItem *qtwi, qtwi_list)
for (QTreeWidgetItem *qtwi: qtwi_list)
qtwi->setHidden(false);
}

View File

@@ -150,7 +150,7 @@ void MasterPropertiesWidget::apply() {
*/
void MasterPropertiesWidget::reset()
{
foreach (QTreeWidgetItem *qtwi, m_qtwi_hash.keys())
for (QTreeWidgetItem *qtwi: m_qtwi_hash.keys())
delete qtwi;
m_qtwi_hash.clear();
@@ -177,7 +177,7 @@ QUndoCommand* MasterPropertiesWidget::associatedUndo() const
{
bool equal = true;
foreach(Element *elmt, to_link)
for (Element *elmt: to_link)
if (!linked_.contains(elmt))
equal = false;
@@ -224,7 +224,7 @@ void MasterPropertiesWidget::updateUi()
//Build the list of free available element
QList <QTreeWidgetItem *> items_list;
foreach(Element *elmt, elmt_prov.freeElement(Element::Slave))
for (Element *elmt: elmt_prov.freeElement(Element::Slave))
{
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_free_tree_widget);
qtwi->setIcon(0, elmt->pixmap());
@@ -243,7 +243,7 @@ void MasterPropertiesWidget::updateUi()
items_list.clear();
//Build the list of already linked element
foreach(Element *elmt, m_element->linkedElements())
for (Element *elmt: m_element->linkedElements())
{
QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_link_tree_widget);
qtwi->setIcon(0, elmt->pixmap());

View File

@@ -82,7 +82,7 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector
if ((elmt_->linkType() & Element::Terminale) && !elmt_->terminals().isEmpty())
{
foreach(Terminal *t, elmt_->terminals())
for (Terminal *t: elmt_->terminals())
{
if (t->conductors().isEmpty()) continue;
conductor_in_potential = t->conductors().first();
@@ -106,7 +106,7 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector
c_list = conductor_in_potential->relatedPotentialConductors().toList();
c_list.append(conductor_in_potential);
foreach(Conductor *c, c_list)
for (Conductor *c: c_list)
properties_list.append(c->properties());
}
@@ -139,14 +139,14 @@ class LinkReportPotentialSelector : public AbstractPotentialSelector
m_seq_num_1 = report->conductors().first()->sequenceNum();
m_conductors_list_1.append(report->conductors().first()->relatedPotentialConductors().toList());
m_conductors_list_1.append(report->conductors().first());
foreach(Conductor *c, m_conductors_list_1)
for (Conductor *c: m_conductors_list_1)
m_properties_list_1 << c->properties();
m_conductor_number_2 = other_report->conductors().first()->relatedPotentialConductors().size() + 1;
m_seq_num_2 = other_report->conductors().first()->sequenceNum();
m_conductors_list_2.append(other_report->conductors().first()->relatedPotentialConductors().toList());
m_conductors_list_2.append(other_report->conductors().first());
foreach(Conductor *c, m_conductors_list_2)
for (Conductor *c: m_conductors_list_2)
m_properties_list_2 << c->properties();
//We relink the report
@@ -283,7 +283,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
new_seq.setValue(m_sequential_num);
//Set the new properties for each conductors of the new potential
foreach(Conductor *cond, m_conductors_to_change)
for (Conductor *cond: m_conductors_to_change)
{
ConductorProperties new_properties = cond->properties();
new_properties.applyForEqualAttributes(m_properties_list);
@@ -296,7 +296,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
//Check if formula of the new potential have incompatible variable with folio report
QRegularExpression rx ("%sequf_|%seqtf_|%seqhf_|%id|%F|%M|%LM");
foreach(ConductorProperties cp, m_properties_list)
for (ConductorProperties cp: m_properties_list)
{
if (cp.m_formula.contains(rx))
{
@@ -316,7 +316,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
QString new_formula = fag.formula();
QSet <Conductor *> c_list = m_report->conductors().first()->relatedPotentialConductors();
c_list.insert(m_report->conductors().first());
foreach(Conductor *cond, c_list)
for (Conductor *cond: c_list)
{
old_value.setValue(cond->properties());
ConductorProperties new_properties = cond->properties();
@@ -351,7 +351,7 @@ void PotentialSelectorDialog::on_buttonBox_accepted()
new QPropertyUndoCommand(m_conductor, "properties", old_value, new_value, undo);
//Set the new properties for each conductors of the new potential
foreach(Conductor *cond, m_conductor->relatedPotentialConductors())
for (Conductor *cond: m_conductor->relatedPotentialConductors())
{
new_properties = cond->properties();
new_properties.applyForEqualAttributes(m_properties_list);

View File

@@ -72,7 +72,7 @@ TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(QList<TitleBlockTemplates
{
ui->setupUi(this);
initDialog(current_date,project);
foreach (TitleBlockTemplatesCollection *c, tbt_collection)
for (TitleBlockTemplatesCollection *c: tbt_collection)
addCollection(c);
updateTemplateList();
setProperties(titleblock);
@@ -230,7 +230,7 @@ TitleBlockTemplateLocation TitleBlockPropertiesWidget::currentTitleBlockLocation
{
QET::QetCollection qc = m_map_index_to_collection_type.at(ui->m_tbt_cb->currentIndex());
TitleBlockTemplatesCollection *collection = nullptr;
foreach (TitleBlockTemplatesCollection *c, m_tbt_collection_list)
for (TitleBlockTemplatesCollection *c: m_tbt_collection_list)
if (c -> collection() == qc)
collection = c;
@@ -307,7 +307,7 @@ void TitleBlockPropertiesWidget::initDialog(const bool &current_date, QETProjec
if (project!= NULL){
keys_2 = project -> folioAutoNum().keys();
foreach (QString str, keys_2) { ui -> auto_page_cb -> addItem(str); }
for (QString str: keys_2) { ui -> auto_page_cb -> addItem(str); }
if (ui->auto_page_cb->currentText()==NULL)
ui->auto_page_cb->addItem(tr("Créer un Folio Numérotation Auto"));
}
@@ -365,7 +365,7 @@ void TitleBlockPropertiesWidget::updateTemplateList()
ui -> m_tbt_cb -> addItem(QET::Icons::QETLogo, tr("Modèle par défaut"));
//Add every title block stored in m_tbt_collection_list
foreach (TitleBlockTemplatesCollection *tbt_c, m_tbt_collection_list)
for (TitleBlockTemplatesCollection *tbt_c: m_tbt_collection_list)
{
QIcon icon;
QET::QetCollection qc = tbt_c -> collection();
@@ -376,7 +376,7 @@ void TitleBlockPropertiesWidget::updateTemplateList()
else if (qc == QET::QetCollection::Embedded)
icon = QET::Icons::TitleBlock;
foreach(QString tbt_name, tbt_c -> templates())
for (QString tbt_name: tbt_c -> templates())
{
m_map_index_to_collection_type.append(qc);
ui -> m_tbt_cb -> addItem(icon, tbt_name, tbt_name);
@@ -394,7 +394,7 @@ void TitleBlockPropertiesWidget::changeCurrentTitleBlockTemplate(int index)
QET::QetCollection qc = m_map_index_to_collection_type.at(index);
TitleBlockTemplatesCollection *collection = nullptr;
foreach (TitleBlockTemplatesCollection *c, m_tbt_collection_list)
for (TitleBlockTemplatesCollection *c: m_tbt_collection_list)
if (c -> collection() == qc)
collection = c;

View File

@@ -177,7 +177,7 @@ void LinkElementCommand::setLink(Element *element_)
*/
void LinkElementCommand::unlink(QList<Element *> element_list)
{
foreach(Element *elmt, element_list)
for (Element *elmt: element_list)
m_linked_after.removeAll(elmt);
}
@@ -218,7 +218,7 @@ void LinkElementCommand::redo()
c_list << m_element->conductors().first();
//fill list of text
QStringList strl;
foreach (const Conductor *c, c_list) strl<<(c->properties().text);
for (const Conductor *c: c_list) strl<<(c->properties().text);
//check text list, isn't same in potential, ask user what to do
if (!QET::eachStrIsEqual(strl))
@@ -245,7 +245,7 @@ void LinkElementCommand::setUpNewLink(const QList<Element *> &element_list, bool
//if m_element isn't master (may be a report or slave) we can connect only one element
if (m_element->linkType() == Element::Master || element_list.size() == 1)
{
foreach(Element *elmt, element_list)
for (Element *elmt: element_list)
if (isLinkable(m_element, elmt, already_link))
m_linked_after << elmt;
}
@@ -253,7 +253,7 @@ void LinkElementCommand::setUpNewLink(const QList<Element *> &element_list, bool
{
qDebug() << "LinkElementCommand::setUpNewLink : try to link several elements to a report element or slave element,"
" only the first element of the list will be taken to be linked";
foreach(Element *elmt, element_list)
for (Element *elmt: element_list)
if (isLinkable(m_element, elmt, already_link))
{
m_linked_after << elmt;
@@ -278,17 +278,17 @@ void LinkElementCommand::makeLink(const QList<Element *> &element_list)
}
//We link all element from element_list
foreach(Element *elmt, element_list)
for (Element *elmt: element_list)
m_element->linkToElement(elmt);
//At this point may be there are unwanted linked elements to m_element. We must to unlink it.
//Elements from @element_list are wanted so we compare @element_list to current linked element of @m_element
QList<Element *> to_unlink = m_element->linkedElements();
foreach(Element *elmt, element_list)
for (Element *elmt: element_list)
to_unlink.removeAll(elmt);
//All elements stored in to_unlink is unwanted we unlink it from m_element
if (!to_unlink.isEmpty())
foreach(Element *elmt, to_unlink)
for (Element *elmt: to_unlink)
m_element->unlinkElement(elmt);
}