diff --git a/sources/ElementsCollection/elementcollectionhandler.cpp b/sources/ElementsCollection/elementcollectionhandler.cpp index 79255897e..6348a4391 100644 --- a/sources/ElementsCollection/elementcollectionhandler.cpp +++ b/sources/ElementsCollection/elementcollectionhandler.cpp @@ -101,7 +101,7 @@ ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, Element if (source_dir == destination_dir) copy_itself = true; - for (QString str : source_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)) + foreach(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"); - for (QString str: source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name)) + foreach(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)) ); - for (QString name : directories_names) + foreach(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))) ; - for (QString name : elements_names) + foreach (QString name, elements_names) { ElementsLocation source_element(source.projectCollectionPath() + "/" + name); copyElement(source_element, created_location); diff --git a/sources/ElementsCollection/elementcollectionitem.cpp b/sources/ElementsCollection/elementcollectionitem.cpp index bf0455545..7c336b12c 100644 --- a/sources/ElementsCollection/elementcollectionitem.cpp +++ b/sources/ElementsCollection/elementcollectionitem.cpp @@ -50,7 +50,7 @@ ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &pat if (str_list.isEmpty()) return nullptr; ElementCollectionItem *return_eci = this; - for (QString str: str_list) + foreach (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(); - for (QStandardItem *qsi: directChilds()) { + foreach (QStandardItem *qsi, directChilds()) { ElementCollectionItem *eci = static_cast(qsi); if (eci->name() == name) return eci; @@ -128,7 +128,7 @@ int ElementCollectionItem::rowForInsertItem(const QString &name) return 0; } - for (ElementCollectionItem *eci: child) + foreach (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; - for (QString str: str_list) { + foreach (QString str, str_list) { ElementCollectionItem *eci = match_eci->childWithCollectionName(str); if (!eci) return nullptr; @@ -166,7 +166,7 @@ QList ElementCollectionItem::elementsDirectChild() cons { QList element_child; - for (QStandardItem *qsi: directChilds()) { + foreach (QStandardItem *qsi, directChilds()) { ElementCollectionItem *eci = static_cast(qsi); if (eci->isElement()) element_child.append(eci); @@ -183,7 +183,7 @@ QList ElementCollectionItem::directoriesDirectChild() c { QList dir_child; - for (QStandardItem *qsi: directChilds()) { + foreach (QStandardItem *qsi, directChilds()) { ElementCollectionItem *eci = static_cast(qsi); if (eci->isDir()) dir_child.append(eci); @@ -200,7 +200,7 @@ QList ElementCollectionItem::elementsChild() const { QList list = elementsDirectChild(); - for (ElementCollectionItem *eci: directoriesChild()) + foreach (ElementCollectionItem *eci, directoriesChild()) list.append(eci->elementsDirectChild()); return list; @@ -214,7 +214,7 @@ QList ElementCollectionItem::directoriesChild() const { QList list = directoriesDirectChild(); QList child_list; - for (ElementCollectionItem *eci: list) { + foreach (ElementCollectionItem *eci, list) { child_list.append(eci->directoriesChild()); } diff --git a/sources/ElementsCollection/elementscollectionmodel.cpp b/sources/ElementsCollection/elementscollectionmodel.cpp index 8f465b0bd..d8e1b14db 100644 --- a/sources/ElementsCollection/elementscollectionmodel.cpp +++ b/sources/ElementsCollection/elementscollectionmodel.cpp @@ -236,7 +236,7 @@ void ElementsCollectionModel::loadCollections(bool common_collection, bool custo list.append(items()); - for (QETProject *project: projects) { + foreach (QETProject *project, projects) { addProject(project, false); list.append(projectItems(project)); } @@ -310,7 +310,7 @@ void ElementsCollectionModel::addLocation(ElementsLocation location) for (int i=0 ; i(item(i))); - for (ElementCollectionItem *eci: child_list) { + foreach(ElementCollectionItem *eci, child_list) { if (eci->type() == FileElementCollectionItem::Type) { FileElementCollectionItem *feci = static_cast(eci); @@ -393,14 +393,14 @@ void ElementsCollectionModel::highlightUnusedElement() { QList unused; - for (QETProject *project: m_project_list) + foreach (QETProject *project, m_project_list) unused.append(project->unusedElements()); QBrush brush; brush.setStyle(Qt::Dense4Pattern); brush.setColor(Qt::red); - for (ElementsLocation location: unused) { + foreach (ElementsLocation location, unused) { QModelIndex index = indexFromLocation(location); if (index.isValid()) { QStandardItem *qsi = itemFromIndex(index); @@ -452,7 +452,7 @@ QList ElementsCollectionModel::projectItems(QETProject void ElementsCollectionModel::hideElement() { m_hide_element = true; - for (ElementCollectionItem *eci: items()) { + foreach(ElementCollectionItem *eci, items()) { if (eci->isElement()) { removeRow(eci->row(), indexFromItem(eci).parent()); } @@ -473,7 +473,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l for (int i=0 ; i(item(i))); - foreach (ElementCollectionItem *eci, child_list) { + foreach(ElementCollectionItem *eci, child_list) { ElementCollectionItem *match_eci = nullptr; @@ -514,7 +514,7 @@ void ElementsCollectionModel::elementIntegratedToCollection(QString path) QETProject *project = nullptr; //Get the owner project of the collection - for (QETProject *prj: m_project_list) { + foreach (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 - for (QETProject *prj: m_project_list) { + foreach (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 - for (QETProject *prj: m_project_list) { + foreach (QETProject *prj, m_project_list) { if (prj->embeddedElementCollection() == collection) { project = prj; } diff --git a/sources/ElementsCollection/elementscollectionwidget.cpp b/sources/ElementsCollection/elementscollectionwidget.cpp index 39e027b83..553bfced1 100644 --- a/sources/ElementsCollection/elementscollectionwidget.cpp +++ b/sources/ElementsCollection/elementscollectionwidget.cpp @@ -311,7 +311,7 @@ void ElementsCollectionWidget::editElement() QETApp *app = QETApp::instance(); app->openElementLocations(QList() << location); - for (QETElementEditor *element_editor: app->elementEditors()) + foreach (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(); - for (QETElementEditor *element_editor: QETApp::instance()->elementEditors()) + foreach (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; - for (QString txt: text_list) { + foreach (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); } - for (QModelIndex index: match_index) + foreach(QModelIndex index, match_index) showAndExpandItem(index); } diff --git a/sources/ElementsCollection/fileelementcollectionitem.cpp b/sources/ElementsCollection/fileelementcollectionitem.cpp index 3978ed294..4af9d4b45 100644 --- a/sources/ElementsCollection/fileelementcollectionitem.cpp +++ b/sources/ElementsCollection/fileelementcollectionitem.cpp @@ -297,7 +297,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element) QDir dir (fileSystemPath()); //Get all directory in this directory. - for (QString str: dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)) + foreach(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"); - for (QString str: dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name)) + foreach(QString str, dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name)) { FileElementCollectionItem *feci = new FileElementCollectionItem(); appendRow(feci); diff --git a/sources/ElementsCollection/xmlelementcollection.cpp b/sources/ElementsCollection/xmlelementcollection.cpp index 66dcef9f8..3cdfe4552 100644 --- a/sources/ElementsCollection/xmlelementcollection.cpp +++ b/sources/ElementsCollection/xmlelementcollection.cpp @@ -136,7 +136,7 @@ QDomElement XmlElementCollection::child(const QDomElement &parent_element, const if (found_dom_element.isEmpty()) return QDomElement(); - for (QDomElement elmt: found_dom_element) + foreach (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(); - for (QString str: path_list) + foreach (QString str, path_list) { QDomElement child_element = child(parent_element, str); @@ -198,7 +198,7 @@ QStringList XmlElementCollection::directoriesNames(const QDomElement &parent_ele QList childs = directories(parent_element); QStringList names; - for (QDomElement child: childs) + foreach (QDomElement child, childs) { QString name = child.attribute("name"); if (!name.isEmpty()) @@ -239,7 +239,7 @@ QStringList XmlElementCollection::elementsNames(const QDomElement &parent_elemen QList childs = elements(parent_element); QStringList names; - for (QDomElement child: childs) + foreach (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(); - for (QString str: splitted_path) { + foreach(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; - for (QString str: splitted_path) { + foreach(QString str, splitted_path) { if (path.isEmpty()) path = str; else @@ -585,7 +585,7 @@ QList XmlElementCollection::elementsLocation(QDomElement dom_e //get element childs QList element_list = elements(dom_element); - for (QDomElement elmt: element_list) { + foreach (QDomElement elmt, element_list) { ElementsLocation location = domToLocation(elmt); if (location.exist()) location_list << location; @@ -594,7 +594,7 @@ QList XmlElementCollection::elementsLocation(QDomElement dom_e //get directory childs QList directory_list = directories(dom_element); - for (QDomElement dir: directory_list) { + foreach (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() { - for (ElementsLocation loc: m_project->unusedElements()) + foreach (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 - for (QString str: source_dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)) + foreach(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"); - for (QString str: source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name)) + foreach(QString str, source_dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name)) { ElementsLocation sub_source(source.fileSystemPath() + "/" + str); copyElement(sub_source, created_location); diff --git a/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp b/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp index 28d03e6b8..942c09ce1 100644 --- a/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp +++ b/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp @@ -227,7 +227,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element) QList 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"));}); - for (QDomElement element: dom_category) + foreach (QDomElement element, dom_category) { XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem(); appendRow(xpeci); @@ -242,7 +242,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element) QList 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"));}); - for (QDomElement element: dom_elements) + foreach (QDomElement element, dom_elements) { XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem(); appendRow(xpeci); diff --git a/sources/PropertiesEditor/propertieseditordockwidget.cpp b/sources/PropertiesEditor/propertieseditordockwidget.cpp index cc4068479..0bec4d803 100644 --- a/sources/PropertiesEditor/propertieseditordockwidget.cpp +++ b/sources/PropertiesEditor/propertieseditordockwidget.cpp @@ -48,7 +48,7 @@ PropertiesEditorDockWidget::~PropertiesEditorDockWidget() */ void PropertiesEditorDockWidget::clear() { - for (PropertiesEditorWidget *editor: m_editor_list) + foreach (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() { - for (PropertiesEditorWidget *editor: m_editor_list) + foreach(PropertiesEditorWidget *editor, m_editor_list) editor->apply(); } @@ -74,7 +74,7 @@ void PropertiesEditorDockWidget::apply() */ void PropertiesEditorDockWidget::reset() { - for (PropertiesEditorWidget *editor: m_editor_list) + foreach(PropertiesEditorWidget *editor, m_editor_list) editor->reset(); } diff --git a/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp b/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp index b24fdd295..656218016 100644 --- a/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp +++ b/sources/QetGraphicsItemModeler/qetgraphicshandlerutility.cpp @@ -56,7 +56,7 @@ void QetGraphicsHandlerUtility::drawHandler(QPainter *painter, const QPointF &po * @param color2 */ void QetGraphicsHandlerUtility::drawHandler(QPainter *painter, const QVector &points) { - for (QPointF point: points) + foreach(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 &vector) const { - for (QPointF key_point: vector) + foreach (QPointF key_point, vector) if (pointIsInHandler(point, key_point)) return vector.indexOf(key_point); @@ -96,7 +96,7 @@ QVector QetGraphicsHandlerUtility::handlerRect(const QVector &v { QVector rect_vector; - for (QPointF point: vector) + foreach(QPointF point, vector) rect_vector << getRect(point); return rect_vector; diff --git a/sources/autoNum/numerotationcontext.cpp b/sources/autoNum/numerotationcontext.cpp index 6c1a3faf8..7a89f7390 100644 --- a/sources/autoNum/numerotationcontext.cpp +++ b/sources/autoNum/numerotationcontext.cpp @@ -154,7 +154,7 @@ QDomElement NumerotationContext::toXml(QDomDocument &d, QString str) { */ void NumerotationContext::fromXml(QDomElement &e) { clear(); - for (QDomElement qde: QET::findInDomElement(e, "part")) addValue(qde.attribute("type"), qde.attribute("value"), qde.attribute("increase").toInt(), qde.attribute("initialvalue").toInt()); + foreach(QDomElement qde, QET::findInDomElement(e, "part")) addValue(qde.attribute("type"), qde.attribute("value"), qde.attribute("increase").toInt(), qde.attribute("initialvalue").toInt()); } /** diff --git a/sources/autoNum/ui/autonumberingdockwidget.cpp b/sources/autoNum/ui/autonumberingdockwidget.cpp index cf4a395b7..528616139 100644 --- a/sources/autoNum/ui/autonumberingdockwidget.cpp +++ b/sources/autoNum/ui/autonumberingdockwidget.cpp @@ -106,21 +106,21 @@ void AutoNumberingDockWidget::setContext() { ui->m_conductor_cb->addItem(""); QList keys_conductor = m_project->conductorAutoNum().keys(); if (!keys_conductor.isEmpty()) { - for (QString str: keys_conductor) { ui->m_conductor_cb-> addItem(str); } + foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); } } //Element Combobox ui->m_element_cb->addItem(""); QList keys_element = m_project->elementAutoNum().keys(); if (!keys_element.isEmpty()) { - for (QString str: keys_element) {ui->m_element_cb -> addItem(str);} + foreach (QString str, keys_element) {ui->m_element_cb -> addItem(str);} } //Folio Combobox ui->m_folio_cb->addItem(""); QList keys_folio = m_project->folioAutoNum().keys(); if (!keys_folio.isEmpty()) { - for (QString str: keys_folio) { ui->m_folio_cb -> addItem(str);} + foreach (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 keys_conductor = m_project->conductorAutoNum().keys(); if (!keys_conductor.isEmpty()) { - for (QString str: keys_conductor) { ui->m_conductor_cb-> addItem(str); } + foreach (QString str, keys_conductor) { ui->m_conductor_cb-> addItem(str); } } setActive(); } @@ -209,7 +209,7 @@ void AutoNumberingDockWidget::elementAutoNumChanged() { ui->m_element_cb->addItem(""); QList keys_element = m_project->elementAutoNum().keys(); if (!keys_element.isEmpty()) { - for (QString str: keys_element) {ui->m_element_cb -> addItem(str);} + foreach (QString str, keys_element) {ui->m_element_cb -> addItem(str);} } setActive(); } @@ -237,7 +237,7 @@ void AutoNumberingDockWidget::folioAutoNumChanged() { ui->m_folio_cb->addItem(""); QList keys_folio = m_project->folioAutoNum().keys(); if (!keys_folio.isEmpty()) { - for (QString str: keys_folio) { ui->m_folio_cb -> addItem(str);} + foreach (QString str, keys_folio) { ui->m_folio_cb -> addItem(str);} } setActive(); } diff --git a/sources/autoNum/ui/autonumberingmanagementw.cpp b/sources/autoNum/ui/autonumberingmanagementw.cpp index 4cfaaf1c8..029ff2896 100644 --- a/sources/autoNum/ui/autonumberingmanagementw.cpp +++ b/sources/autoNum/ui/autonumberingmanagementw.cpp @@ -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(""); - for (Diagram *diagram: project_->diagrams()){ + foreach (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()); diff --git a/sources/autoNum/ui/folioautonumbering.cpp b/sources/autoNum/ui/folioautonumbering.cpp index de4810ec1..77f3d27fb 100644 --- a/sources/autoNum/ui/folioautonumbering.cpp +++ b/sources/autoNum/ui/folioautonumbering.cpp @@ -51,7 +51,7 @@ FolioAutonumberingW::~FolioAutonumberingW() * construct autonums in the comboBox selected in the @autonum_chooser QcomboBox */ void FolioAutonumberingW::setContext(QList autonums) { - for (QString str: autonums) { ui->m_autonums_cb->addItem(str);} + foreach (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(""); - for (Diagram *diagram: project_->diagrams()){ + foreach (Diagram *diagram, project_->diagrams()){ ui->m_from_cb->addItem(diagram->title()); } } diff --git a/sources/autoNum/ui/selectautonumw.cpp b/sources/autoNum/ui/selectautonumw.cpp index d87ff8ede..cab80f636 100644 --- a/sources/autoNum/ui/selectautonumw.cpp +++ b/sources/autoNum/ui/selectautonumw.cpp @@ -105,7 +105,7 @@ void SelectAutonumW::setContext(const NumerotationContext &context) { */ NumerotationContext SelectAutonumW::toNumContext() const { NumerotationContext nc; - for (NumPartEditorW *npew: num_part_list_) nc << npew -> toNumContext(); + foreach (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; - for (NumPartEditorW *npe: num_part_list_) if (!npe -> isValid()) valid= false; + foreach (NumPartEditorW *npe, num_part_list_) if (!npe -> isValid()) valid= false; ui -> buttonBox -> button(QDialogButtonBox::Apply) -> setEnabled(valid); } else { diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index 10b418669..e63a26631 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -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; - for (QString key: additional_fields_.keys()) { + foreach (QString key, additional_fields_.keys()) { context.addValue(key, additional_fields_[key]); } diff --git a/sources/conductorautonumerotation.cpp b/sources/conductorautonumerotation.cpp index 84963ecde..065036f31 100644 --- a/sources/conductorautonumerotation.cpp +++ b/sources/conductorautonumerotation.cpp @@ -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")); - for (Conductor *cond: conductor_list) + foreach (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; - for (const Conductor *conductor: conductor_list) + foreach (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; - for (const Conductor *cc: conductor_list) + foreach (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 cp_list; - for (Conductor *c: conductor_list) + foreach(Conductor *c, conductor_list) cp_list<properties(); ConductorProperties cp = m_conductor->properties(); diff --git a/sources/conductorprofile.cpp b/sources/conductorprofile.cpp index bc40d0fdd..d3d43d061 100644 --- a/sources/conductorprofile.cpp +++ b/sources/conductorprofile.cpp @@ -39,7 +39,7 @@ ConductorProfile::ConductorProfile(Conductor *conductor) { ConductorProfile::ConductorProfile(const ConductorProfile &c) { beginOrientation = c.beginOrientation; endOrientation = c.endOrientation; - for (ConductorSegmentProfile *csp: c.segments) { + foreach(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; - for (ConductorSegmentProfile *csp: c.segments) { + foreach(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() { - for (ConductorSegmentProfile *csp: segments) delete csp; + foreach(ConductorSegmentProfile *csp, segments) delete csp; segments.clear(); } /// @return la largeur occupee par le conducteur qreal ConductorProfile::width() const { qreal width = 0.0; - for (ConductorSegmentProfile *csp: segments) { + foreach(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; - for (ConductorSegmentProfile *csp: segments) { + foreach(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; - for (ConductorSegmentProfile *csp: segments) { + foreach(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 ConductorProfile::horizontalSegments() { QList segments_list; - for (ConductorSegmentProfile *csp: segments) { + foreach(ConductorSegmentProfile *csp, segments) { if (csp -> isHorizontal) segments_list << csp; } return(segments_list); @@ -123,7 +123,7 @@ QList ConductorProfile::horizontalSegments() { /// @return les segments verticaux de ce profil QList ConductorProfile::verticalSegments() { QList segments_list; - for (ConductorSegmentProfile *csp: segments) { + foreach(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(); - for (ConductorSegment *conductor_segment: conductor -> segmentsList()) { + foreach(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 {"; - for (ConductorSegmentProfile *csp: t.segments) { + foreach(ConductorSegmentProfile *csp, t.segments) { d << "CSP" << (csp -> isHorizontal ? "horizontal" : "vertical") << ":" << csp -> length << ","; } d << "}"; diff --git a/sources/conductorproperties.cpp b/sources/conductorproperties.cpp index 2b56afcb3..a42217f2e 100644 --- a/sources/conductorproperties.cpp +++ b/sources/conductorproperties.cpp @@ -412,7 +412,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis bool equal = true; //Color QColor c_value = list.first().color; - for (ConductorProperties cp: list) + foreach(ConductorProperties cp, list) { if (cp.color != c_value) equal = false; @@ -423,7 +423,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //text QString s_value = list.first().text; - for (ConductorProperties cp: list) + foreach(ConductorProperties cp, list) { if (cp.text != s_value) equal = false; @@ -434,7 +434,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //formula s_value = list.first().m_formula; - for (ConductorProperties cp: list) + foreach(ConductorProperties cp, list) { if (cp.m_formula != s_value) equal = false; @@ -445,7 +445,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //function s_value = list.first().m_function; - for (ConductorProperties cp: list) + foreach(ConductorProperties cp, list) { if (cp.m_function != s_value) equal = false; @@ -456,7 +456,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //Tension protocol s_value = list.first().m_tension_protocol; - for (ConductorProperties cp: list) + foreach(ConductorProperties cp, list) { if (cp.m_tension_protocol != s_value) equal = false; @@ -467,7 +467,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //text size int i_value = list.first().text_size; - for (ConductorProperties cp: list) + foreach(ConductorProperties cp, list) { if (cp.text_size != i_value) equal = false; @@ -478,7 +478,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //conductor size double d_value = list.first().cond_size; - for (ConductorProperties cp: list) + foreach(ConductorProperties cp, list) { if (cp.cond_size != d_value) equal = false; @@ -489,7 +489,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //show text bool b_value = list.first().m_show_text; - for (ConductorProperties cp: list) + foreach(ConductorProperties cp, list) { if (cp.m_show_text != b_value) equal = false; @@ -500,7 +500,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //One text per folio b_value = list.first().m_one_text_per_folio; - for (ConductorProperties cp: list) + foreach(ConductorProperties cp, list) { if (cp.m_one_text_per_folio != b_value) equal = false; @@ -511,7 +511,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //Text rotation for vertical conducor d_value = list.first().verti_rotate_text; - for (ConductorProperties cp: list) + foreach(ConductorProperties cp, list) { if (cp.verti_rotate_text != d_value) equal = false; @@ -522,7 +522,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //Text rotation for horizontal conducor d_value = list.first().horiz_rotate_text; - for (ConductorProperties cp: list) + foreach(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*$"); - for (QString style_str: styles) { + foreach (QString style_str, styles) { if (rx.exactMatch(style_str)) { QString style_name = rx.cap(1); QString style_value = rx.cap(2); diff --git a/sources/configdialog.cpp b/sources/configdialog.cpp index 7f5f9ed36..3fe31a543 100644 --- a/sources/configdialog.cpp +++ b/sources/configdialog.cpp @@ -70,7 +70,7 @@ ConfigDialog::~ConfigDialog() { */ void ConfigDialog::buildPagesList() { pages_list -> clear(); - for (ConfigPage *page: pages) { + foreach(ConfigPage *page, pages) { addPageToList(page); } } @@ -90,7 +90,7 @@ void ConfigDialog::addPageToList(ConfigPage *page) { Applique la configuration de toutes les pages */ void ConfigDialog::applyConf() { - for (ConfigPage *page: pages) { + foreach(ConfigPage *page, pages) { page -> applyConf(); } accept(); diff --git a/sources/configpages.cpp b/sources/configpages.cpp index e40312001..d108e800e 100644 --- a/sources/configpages.cpp +++ b/sources/configpages.cpp @@ -155,7 +155,7 @@ void NewDiagramPage::applyConf() { // default xref properties QHash hash_xrp = xrefpw -> properties(); - for (QString key: hash_xrp.keys()) { + foreach (QString key, hash_xrp.keys()) { XRefProperties xrp = hash_xrp[key]; QString str("diagrameditor/defaultxref"); xrp.toSettings(settings, str += key); diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 4bca63f9a..9b99928c3 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -107,7 +107,7 @@ Diagram::~Diagram() { // list removable items QList deletable_items; - for (QGraphicsItem *qgi: items()) { + foreach(QGraphicsItem *qgi, items()) { if (qgi -> parentItem()) continue; if (qgraphicsitem_cast(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: - for (Element *item: selectedContent().elements) { + foreach (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: - for (Element *item:selectedContent().elements) { + foreach (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 selected_elmts = selectedItems(); - for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(false); + foreach (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 - for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(true); + foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(true); return(true); } @@ -438,7 +438,7 @@ QList < QSet > Diagram::potentials() { do { QSet one_potential = conductors_list.first() -> relatedPotentialConductors(); one_potential << conductors_list.takeFirst(); - for (Conductor *c: one_potential) conductors_list.removeOne(c); + foreach (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 list_items = items(); ; // Determine les elements a "XMLiser" - for (QGraphicsItem *qgi: list_items) { + foreach(QGraphicsItem *qgi, list_items) { if (Element *elmt = qgraphicsitem_cast(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"); - for (Element *elmt: list_elements) { + foreach(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"); - for (Conductor *cond: list_conductors) { + foreach(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"); - for (DiagramTextItem *dti: list_texts) { + foreach(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"); - for (DiagramImageItem *dii: list_images) { + foreach (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"); - for (QetShapeItem *dii: list_shapes) { + foreach (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; - for (QDomElement element_xml: QET::findInDomElement(root, "elements", "element")) { + foreach (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 added_elements; QHash table_adr_id; - for (QDomElement element_xml: QET::findInDomElement(root, "elements", "element")) + foreach (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 added_texts; - for (QDomElement text_xml: QET::findInDomElement(root, "inputs", "input")) { + foreach (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 added_images; - for (QDomElement image_xml: QET::findInDomElement(root, "images", "image")) { + foreach (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 added_shapes; - for (QDomElement shape_xml: QET::findInDomElement(root, "shapes", "shape")) { + foreach (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 added_conductors; - for (QDomElement f: QET::findInDomElement(root, "conductors", "conductor")) + foreach (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 added_items; - 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; + 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; //Get the top left corner of the rectangle that contain all added items QRectF items_rect; - for (QGraphicsItem *item: added_items) { + foreach (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 - for (QGraphicsItem *qgi: added_items) + foreach (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* hash, QString folioSeq, QString seq, QString type, QString autonumFolioSeqType) { - for (QDomElement folioSeqAutoNum: QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) { + foreach (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() { - for (Element *elmt: elements()) + foreach (Element *elmt, elements()) elmt->initLink(project()); - for (Conductor *conductor: conductors()) + foreach (Conductor *conductor, conductors()) conductor->refreshText(); } @@ -1127,7 +1127,7 @@ void Diagram::selectAll() { if (items().isEmpty()) return; blockSignals(true); - for (QGraphicsItem *qgi: items()) qgi -> setSelected(true); + foreach(QGraphicsItem *qgi, items()) qgi -> setSelected(true); blockSignals(false); emit(selectionChanged()); } @@ -1148,7 +1148,7 @@ void Diagram::invertSelection() { if (items().isEmpty()) return; blockSignals(true); - for (QGraphicsItem *item: items()) item -> setSelected(!item -> isSelected()); + foreach (QGraphicsItem *item, items()) item -> setSelected(!item -> isSelected()); blockSignals(false); emit(selectionChanged()); } @@ -1159,11 +1159,11 @@ void Diagram::invertSelection() { * in their labels. */ void Diagram::updateLabels() { - for (Element *elmt: elements()) { + foreach (Element *elmt, elements()) { if (elmt->elementInformations()["label"].toString().contains(("%F"))) elmt->updateLabel(); } - for (Conductor *cnd: content().conductors()) { + foreach (Conductor *cnd, content().conductors()) { cnd->refreshText(); } } @@ -1341,7 +1341,7 @@ QString Diagram::title() const { */ QList Diagram::customElements() const { QList elements_list; - for (QGraphicsItem *qgi: items()) { + foreach(QGraphicsItem *qgi, items()) { if (CustomElement *elmt = qgraphicsitem_cast(qgi)) { elements_list << elmt; } @@ -1351,7 +1351,7 @@ QList Diagram::customElements() const { QList Diagram::elements() const { QList element_list; - for (QGraphicsItem *qgi: items()) { + foreach (QGraphicsItem *qgi, items()) { if (Element *elmt = qgraphicsitem_cast(qgi)) element_list < Diagram::elements() const { */ QList Diagram::conductors() const { QList cnd_list; - for (QGraphicsItem *qgi: items()) { + foreach (QGraphicsItem *qgi, items()) { if (Conductor *cnd = qgraphicsitem_cast(qgi)) cnd_list < location() == location) { return(true); } @@ -1455,7 +1455,7 @@ bool Diagram::usesTitleBlockTemplate(const QString &name) { * Freeze every existent element label. */ void Diagram::freezeElements(bool freeze) { - for (Element *elmt: elements()) { + foreach (Element *elmt, elements()) { elmt->freezeLabel(freeze); } } @@ -1465,7 +1465,7 @@ void Diagram::freezeElements(bool freeze) { * Unfreeze every existent element label. */ void Diagram::unfreezeElements() { - for (Element *elmt: elements()) { + foreach (Element *elmt, elements()) { elmt->freezeLabel(false); } } @@ -1491,7 +1491,7 @@ bool Diagram::freezeNewElements() { * Freeze every existent conductor label. */ void Diagram::freezeConductors(bool freeze) { - for (Conductor *cnd: conductors()) { + foreach (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) { - for (QGraphicsItem *qgi: items()) { + foreach(QGraphicsItem *qgi, items()) { if (Terminal *t = qgraphicsitem_cast(qgi)) { t -> setVisible(dt); } @@ -1616,7 +1616,7 @@ void Diagram::setDrawColoredConductors(bool dcc) { */ QSet Diagram::selectedConductors() const { QSet conductors_set; - for (QGraphicsItem *qgi: selectedItems()) { + foreach(QGraphicsItem *qgi, selectedItems()) { if (Conductor *c = qgraphicsitem_cast(qgi)) { conductors_set << c; } @@ -1630,7 +1630,7 @@ QSet Diagram::selectedConductors() const { */ QSet Diagram::selectedTexts() const { QSet selected_texts; - for (QGraphicsItem *item: selectedItems()) { + foreach(QGraphicsItem *item, selectedItems()) { if (ConductorTextItem *cti = qgraphicsitem_cast(item)) { selected_texts << cti; } else if (ElementTextItem *eti = qgraphicsitem_cast(item)) { @@ -1648,7 +1648,7 @@ QSet Diagram::selectedTexts() const { */ QSet Diagram::selectedConductorTexts() const { QSet selected_texts; - for (QGraphicsItem *item: selectedItems()) { + foreach(QGraphicsItem *item, selectedItems()) { if (ConductorTextItem *cti = qgraphicsitem_cast(item)) { selected_texts << cti; } @@ -1662,7 +1662,7 @@ QSet Diagram::selectedConductorTexts() const { */ QSet Diagram::selectedElementTexts() const { QSet selected_texts; - for (QGraphicsItem *item: selectedItems()) { + foreach(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; - for (QGraphicsItem *qgi: items()) { + foreach(QGraphicsItem *qgi, items()) { if (Element *e = qgraphicsitem_cast(qgi)) { dc.elements << e; } else if (IndependentTextItem *iti = qgraphicsitem_cast(qgi)) { @@ -1769,7 +1769,7 @@ DiagramContent Diagram::selectedContent() { DiagramContent dc; // recupere les elements deplaces - for (QGraphicsItem *item: selectedItems()) { + foreach (QGraphicsItem *item, selectedItems()) { if (Element *elmt = qgraphicsitem_cast(item)) { dc.elements << elmt; } else if (IndependentTextItem *iti = qgraphicsitem_cast(item)) { @@ -1790,9 +1790,9 @@ DiagramContent Diagram::selectedContent() { } // pour chaque element deplace, determine les conducteurs qui seront modifies - for (Element *elmt: dc.elements) { - for (Terminal *terminal: elmt -> terminals()) { - for (Conductor *conductor: terminal -> conductors()) { + foreach(Element *elmt, dc.elements) { + foreach(Terminal *terminal, elmt -> terminals()) { + foreach(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 { - for (QGraphicsItem * qgi: selectedItems()) { + foreach(QGraphicsItem * qgi, selectedItems()) { if (qgraphicsitem_cast(qgi) || qgraphicsitem_cast(qgi) || qgraphicsitem_cast(qgi) || diff --git a/sources/diagramcommands.cpp b/sources/diagramcommands.cpp index 90423943c..54e6cc6b8 100644 --- a/sources/diagramcommands.cpp +++ b/sources/diagramcommands.cpp @@ -81,12 +81,12 @@ void DeleteElementsCommand::undo() { diagram -> showMe(); - for (QGraphicsItem *item: removed_content.items()) + foreach(QGraphicsItem *item, removed_content.items()) diagram->addItem(item); //We relink element after every element was added to diagram - for (Element *e: removed_content.elements) - for (Element *elmt: m_link_hash[e]) + foreach(Element *e, removed_content.elements) + foreach (Element *elmt, m_link_hash[e]) e -> linkToElement(elmt); } @@ -98,7 +98,7 @@ void DeleteElementsCommand::redo() { diagram -> showMe(); - for (Conductor *c: removed_content.conductors(DiagramContent::AnyConductor)) + foreach(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() } } - for (Element *e: removed_content.elements) + foreach(Element *e, removed_content.elements) { //Get linked element, for relink it at undo if (!e->linkedElements().isEmpty()) m_link_hash.insert(e, e->linkedElements()); } - for (QGraphicsItem *item: removed_content.items()) + foreach(QGraphicsItem *item, removed_content.items()) diagram->removeItem(item); } @@ -158,7 +158,7 @@ void PasteDiagramCommand::undo() { diagram -> showMe(); - for (QGraphicsItem *item: content.items(filter)) + foreach(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 - for (Element *e: content.elements) { + foreach(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 - for (Conductor *c: content.conductorsToMove) { + foreach (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 { - for (QGraphicsItem *item: content.items(filter)) { + foreach (QGraphicsItem *item, content.items(filter)) { diagram->item_paste = true; diagram->addItem(item); diagram->item_paste = false; } } - for (QGraphicsItem *qgi: content.items()) + foreach (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 - for (QGraphicsItem *qgi: content_to_move.items(dc::Elements | dc::TextFields | dc::Images | dc::Shapes)) { + foreach (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 - for (Conductor *conductor: content_to_move.conductorsToMove) { + foreach(Conductor *conductor, content_to_move.conductorsToMove) { setupAnimation(conductor, "pos", conductor->pos(), conductor->pos() + actual_movement); } // Recalcul the path of other conductor - for (Conductor *conductor: content_to_move.conductorsToUpdate) { + foreach(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(); - for (ConductorTextItem *cti: texts_to_move_.keys()) { + foreach(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 { - for (ConductorTextItem *cti: texts_to_move_.keys()) { + foreach(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(); - for (Element *e: elements_to_rotate) { + foreach(Element *e, elements_to_rotate) { e -> rotateBy(-applied_rotation_angle_); } - for (DiagramTextItem *dti: texts_to_rotate) { + foreach(DiagramTextItem *dti, texts_to_rotate) { //ConductorTextItem have a default rotation angle, we apply a specific treatment if (ConductorTextItem *cti = qgraphicsitem_cast(dti)) { cti -> forceRotateByUser(previous_rotate_by_user_[cti]); @@ -551,16 +551,16 @@ void RotateElementsCommand::undo() { } else {dti -> rotateBy(-applied_rotation_angle_);} } - for (DiagramImageItem *dii: images_to_rotate) dii -> rotateBy(-applied_rotation_angle_); + foreach(DiagramImageItem *dii, images_to_rotate) dii -> rotateBy(-applied_rotation_angle_); } /// refait le pivotement void RotateElementsCommand::redo() { diagram -> showMe(); - for (Element *e: elements_to_rotate) { + foreach(Element *e, elements_to_rotate) { e -> rotateBy(applied_rotation_angle_); } - for (DiagramTextItem *dti: texts_to_rotate) { + foreach(DiagramTextItem *dti, texts_to_rotate) { //we grab the previous rotation by user of each ConductorTextItem if (ConductorTextItem *cti = qgraphicsitem_cast(dti)) { previous_rotate_by_user_.insert(cti, cti -> wasRotateByUser()); @@ -568,7 +568,7 @@ void RotateElementsCommand::redo() { } dti -> rotateBy(applied_rotation_angle_); } - for (DiagramImageItem *dii: images_to_rotate) dii -> rotateBy(applied_rotation_angle_); + foreach(DiagramImageItem *dii, images_to_rotate) dii -> rotateBy(applied_rotation_angle_); } /** @@ -597,7 +597,7 @@ RotateTextsCommand::RotateTextsCommand(const QList &texts, do applied_rotation_angle_(applied_rotation), diagram(texts.first()->diagram()) { - for (DiagramTextItem *text: texts) { + foreach(DiagramTextItem *text, texts) { texts_to_rotate.insert(text, text -> rotationAngle()); } defineCommandName(); @@ -614,7 +614,7 @@ RotateTextsCommand::~RotateTextsCommand() { */ void RotateTextsCommand::undo() { diagram -> showMe(); - for (DiagramTextItem *text: texts_to_rotate.keys()) { + foreach(DiagramTextItem *text, texts_to_rotate.keys()) { if (ConductorTextItem *cti = qgraphicsitem_cast(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(); - for (DiagramTextItem *text: texts_to_rotate.keys()) { + foreach(DiagramTextItem *text, texts_to_rotate.keys()) { if (ConductorTextItem *cti = qgraphicsitem_cast(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(); - for (Conductor *c: conductors_profiles.keys()) { + foreach(Conductor *c, conductors_profiles.keys()) { c -> setProfiles(conductors_profiles[c]); } } @@ -751,7 +751,7 @@ void ResetConductorCommand::undo() { */ void ResetConductorCommand::redo() { diagram -> showMe(); - for (Conductor *c: conductors_profiles.keys()) { + foreach(Conductor *c, conductors_profiles.keys()) { c -> textItem() -> forceMovedByUser (false); c -> textItem() -> forceRotateByUser (false); c -> setProfiles(ConductorProfilesGroup()); diff --git a/sources/diagramcontent.cpp b/sources/diagramcontent.cpp index 4cb9a3ec2..50ab5057b 100644 --- a/sources/diagramcontent.cpp +++ b/sources/diagramcontent.cpp @@ -60,7 +60,7 @@ QList DiagramContent::conductors(int filter) const { if (filter & ConductorsToUpdate) result += conductorsToUpdate; if (filter & OtherConductors) result += otherConductors; if (filter & SelectedOnly) { - for (Conductor *conductor: result) { + foreach(Conductor *conductor, result) { if (!conductor -> isSelected()) result.remove(conductor); } } @@ -89,19 +89,19 @@ int DiagramContent::removeNonMovableItems() { int count_ = 0; - for (Element *elmt: elements) { + foreach(Element *elmt, elements) { if (!elmt->isMovable()) { elements.remove(elmt); ++count_; } } - for (DiagramImageItem *img: images) { + foreach(DiagramImageItem *img, images) { if (!img->isMovable()) { images.remove(img); ++count_; } } - for (QetShapeItem *shape: shapes) { + foreach (QetShapeItem *shape, shapes) { if (!shape->isMovable()) { shapes.remove(shape); ++count_; @@ -116,7 +116,7 @@ int DiagramContent::removeNonMovableItems() */ QList DiagramContent::items(int filter) const { QList items_list; - for (QGraphicsItem *qgi: conductors(filter)) items_list << qgi; + foreach(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 DiagramContent::items(int filter) const { if (filter & Shapes) foreach(QGraphicsItem *qgi, shapes) items_list << qgi; if (filter & SelectedOnly) { - for (QGraphicsItem *qgi: items_list) { + foreach(QGraphicsItem *qgi, items_list) { if (!qgi -> isSelected()) items_list.removeOne(qgi); } } diff --git a/sources/diagramcontext.cpp b/sources/diagramcontext.cpp index e9982c68f..57a6e3ccf 100644 --- a/sources/diagramcontext.cpp +++ b/sources/diagramcontext.cpp @@ -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 { - for (QString key : keys()) { + foreach (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) { - for (QDomElement property : QET::findInDomElement(e, tag_name)) { + foreach (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; - for (QString key : content_.keys()) { + foreach (QString key, content_.keys()) { settings.setArrayIndex(i); settings.setValue("name", key); settings.setValue("value", content_[key].toString()); diff --git a/sources/diagramcontextwidget.cpp b/sources/diagramcontextwidget.cpp index aea9e5a7d..336adb67a 100644 --- a/sources/diagramcontextwidget.cpp +++ b/sources/diagramcontextwidget.cpp @@ -70,7 +70,7 @@ DiagramContext DiagramContextWidget::context() const { void DiagramContextWidget::setContext(const DiagramContext &context) { clear(); int i = 0; - for (QString key: context.keys(DiagramContext::Alphabetical)) { + foreach (QString key, context.keys(DiagramContext::Alphabetical)) { table_ -> setItem(i, 0, new QTableWidgetItem(key)); table_ -> setItem(i, 1, new QTableWidgetItem(context[key].toString())); ++ i; diff --git a/sources/diagramevent/diagrameventaddelement.cpp b/sources/diagramevent/diagrameventaddelement.cpp index 0e0ac2b13..84caefb39 100644 --- a/sources/diagramevent/diagrameventaddelement.cpp +++ b/sources/diagramevent/diagrameventaddelement.cpp @@ -59,7 +59,7 @@ DiagramEventAddElement::DiagramEventAddElement(ElementsLocation &location, Diagr DiagramEventAddElement::~DiagramEventAddElement() { if (m_element) delete m_element; - for (QGraphicsView *view: m_diagram->views()) + foreach(QGraphicsView *view, m_diagram->views()) view -> setContextMenuPolicy(Qt::DefaultContextMenu); } @@ -159,7 +159,7 @@ bool DiagramEventAddElement::keyPressEvent(QKeyEvent *event) */ void DiagramEventAddElement::init() { - for (QGraphicsView *view: m_diagram->views()) + foreach(QGraphicsView *view, m_diagram->views()) view->setContextMenuPolicy(Qt::NoContextMenu); } diff --git a/sources/diagramevent/diagrameventaddimage.cpp b/sources/diagramevent/diagrameventaddimage.cpp index 62c03074e..1309a7a33 100644 --- a/sources/diagramevent/diagrameventaddimage.cpp +++ b/sources/diagramevent/diagrameventaddimage.cpp @@ -45,7 +45,7 @@ DiagramEventAddImage::~DiagramEventAddImage() delete m_image; } - for (QGraphicsView *view: m_diagram->views()) + foreach (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(m_image, m_diagram, pos)); - for (QGraphicsView *view: m_diagram->views()) + foreach (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) { - for (QGraphicsView *view: m_diagram->views()) + foreach (QGraphicsView *view, m_diagram->views()) view->setContextMenuPolicy((Qt::NoContextMenu)); m_diagram -> addItem(m_image); diff --git a/sources/diagramevent/diagrameventaddshape.cpp b/sources/diagramevent/diagrameventaddshape.cpp index 9063ad599..db9f1c19b 100644 --- a/sources/diagramevent/diagrameventaddshape.cpp +++ b/sources/diagramevent/diagrameventaddshape.cpp @@ -49,7 +49,7 @@ DiagramEventAddShape::~DiagramEventAddShape() delete m_help_horiz; delete m_help_verti; - for (QGraphicsView *v: m_diagram->views()) + foreach (QGraphicsView *v, m_diagram->views()) v->setContextMenuPolicy(Qt::DefaultContextMenu); } @@ -191,7 +191,7 @@ bool DiagramEventAddShape::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event void DiagramEventAddShape::init() { - for (QGraphicsView *v: m_diagram->views()) + foreach (QGraphicsView *v, m_diagram->views()) v->setContextMenuPolicy(Qt::NoContextMenu); } diff --git a/sources/diagramprintdialog.cpp b/sources/diagramprintdialog.cpp index 5fef6cb77..965c6cbb6 100644 --- a/sources/diagramprintdialog.cpp +++ b/sources/diagramprintdialog.cpp @@ -395,11 +395,11 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const Exp // deselectionne tous les elements QList selected_elmts = diagram -> selectedItems(); - for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(false); + foreach (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 focusable_items; - for (QGraphicsItem *qgi: diagram -> items()) { + foreach (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 - for (QGraphicsView *view: diagram -> views()) { + foreach (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 - for (QGraphicsView *view: diagram -> views()) { + foreach (QGraphicsView *view, diagram -> views()) { view -> setInteractive(true); } // restaure les flags focusable - for (QGraphicsItem *qgi: focusable_items) { + foreach (QGraphicsItem *qgi, focusable_items) { qgi -> setFlag(QGraphicsItem::ItemIsFocusable, true); } // restaure les elements selectionnes - for (QGraphicsItem *qgi: selected_elmts) qgi -> setSelected(true); + foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(true); saveReloadDiagramParameters(diagram, options, false); } diff --git a/sources/diagramschooser.cpp b/sources/diagramschooser.cpp index 9f3865ed4..6852f82d5 100644 --- a/sources/diagramschooser.cpp +++ b/sources/diagramschooser.cpp @@ -62,7 +62,7 @@ QETProject *DiagramsChooser::project() const { */ QList DiagramsChooser::selectedDiagrams() const { QList selected_diagrams; - for (Diagram *diagram: project_ -> diagrams()) { + foreach(Diagram *diagram, project_ -> diagrams()) { QCheckBox *check_box = diagrams_[diagram]; if (check_box && check_box -> isChecked()) { selected_diagrams << diagram; @@ -76,7 +76,7 @@ QList DiagramsChooser::selectedDiagrams() const { */ QList DiagramsChooser::nonSelectedDiagrams() const { QList selected_diagrams; - for (Diagram *diagram: diagrams_.keys()) { + foreach(Diagram *diagram, diagrams_.keys()) { if (!(diagrams_[diagram] -> isChecked())) { selected_diagrams << diagram; } @@ -107,14 +107,14 @@ void DiagramsChooser::setSelectedDiagrams(const QList &diagrams_list, // deselectionne tous les schemas si demande if (reset) { - for (QCheckBox *check_box: diagrams_.values()) { + foreach(QCheckBox *check_box, diagrams_.values()) { check_box -> setChecked(false); } } int changes = 0; QCheckBox *check_box; - for (Diagram *diagram: diagrams_list) { + foreach(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 &diagrams_list, */ void DiagramsChooser::setSelectedAllDiagrams(bool select) { blockSignals(true); - for (QCheckBox *check_box: diagrams_.values()) { + foreach(QCheckBox *check_box, diagrams_.values()) { check_box -> setChecked(select); } blockSignals(false); @@ -159,7 +159,7 @@ void DiagramsChooser::updateList() { buildLayout(); // recree les checkbox necessaires - for (Diagram *diagram: project_ -> diagrams()) { + foreach(Diagram *diagram, project_ -> diagrams()) { // titre du schema QString diagram_title = diagram -> title(); if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre"); diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index 10169b258..469c96ba5 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -149,7 +149,7 @@ void DiagramView::rotateSelection() { QList elements_to_rotate; QList texts_to_rotate; QList images_to_rotate; - for (QGraphicsItem *item: scene -> selectedItems()) { + foreach (QGraphicsItem *item, scene -> selectedItems()) { if (Element *e = qgraphicsitem_cast(item)) { elements_to_rotate << e; } else if (ConductorTextItem *cti = qgraphicsitem_cast(item)) { @@ -176,7 +176,7 @@ void DiagramView::rotateTexts() { // recupere les champs de texte a orienter QList texts_to_rotate; - for (QGraphicsItem *item: scene -> selectedItems()) { + foreach (QGraphicsItem *item, scene -> selectedItems()) { if (ConductorTextItem *cti = qgraphicsitem_cast(item)) { texts_to_rotate << cti; } else if (IndependentTextItem *iti = qgraphicsitem_cast(item)) { @@ -714,7 +714,7 @@ void DiagramView::keyReleaseEvent(QKeyEvent *e) { void DiagramView::scrollOnMovement(QKeyEvent *e){ QList selected_elmts = scene->selectedContent().items(255); QRectF viewed_scene = viewedSceneRect(); - for (QGraphicsItem *qgi: selected_elmts){ + foreach (QGraphicsItem *qgi, selected_elmts){ if (qgraphicsitem_cast(qgi)) continue; if (qgraphicsitem_cast(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() { - for (QGraphicsItem *qgi: scene -> selectedItems()) { + foreach(QGraphicsItem *qgi, scene -> selectedItems()) { if ( qgraphicsitem_cast(qgi) || qgraphicsitem_cast(qgi) || @@ -819,7 +819,7 @@ bool DiagramView::hasCopiableItems() { @return true if there is any Text Item selected */ bool DiagramView::hasTextItems() { - for (QGraphicsItem *qgi: scene -> selectedItems()) { + foreach(QGraphicsItem *qgi, scene -> selectedItems()) { if ( qgraphicsitem_cast(qgi) || qgraphicsitem_cast(qgi) || @@ -837,7 +837,7 @@ bool DiagramView::hasTextItems() { peuvent etre supprimes, false sinon */ bool DiagramView::hasDeletableItems() { - for (QGraphicsItem *qgi: scene -> selectedItems()) { + foreach(QGraphicsItem *qgi, scene -> selectedItems()) { if ( qgraphicsitem_cast(qgi) || qgraphicsitem_cast(qgi) || @@ -1068,7 +1068,7 @@ void DiagramView::resetConductors() { // repere les conducteurs modifies (= profil non nul) QHash conductors_and_profiles; - for (Conductor *conductor: selected_conductors) { + foreach(Conductor *conductor, selected_conductors) { ConductorProfilesGroup profile = conductor -> profiles(); if ( !profile[Qt::TopLeftCorner].isNull() ||\ diff --git a/sources/editor/editorcommands.cpp b/sources/editor/editorcommands.cpp index 00a1f5c21..a23d322be 100644 --- a/sources/editor/editorcommands.cpp +++ b/sources/editor/editorcommands.cpp @@ -89,14 +89,14 @@ DeletePartsCommand::DeletePartsCommand( ElementEditionCommand(QObject::tr("suppression", "undo caption"), scene, 0, parent), deleted_parts(parts) { - for (QGraphicsItem *qgi: deleted_parts) { + foreach(QGraphicsItem *qgi, deleted_parts) { editor_scene_ -> qgiManager().manage(qgi); } } /// Destructeur : detruit egalement les parties supprimees DeletePartsCommand::~DeletePartsCommand() { - for (QGraphicsItem *qgi: deleted_parts) { + foreach(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); - for (QGraphicsItem *qgi: deleted_parts) { + foreach(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); - for (QGraphicsItem *qgi: deleted_parts) { + foreach(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); - for (QGraphicsItem *part: content_) { + foreach(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); - for (QGraphicsItem *part: content_) { + foreach(QGraphicsItem *part, content_) { editor_scene_ -> addItem(part); } editor_scene_ -> blockSignals(false); @@ -240,7 +240,7 @@ MovePartsCommand::~MovePartsCommand() { /// Annule le deplacement void MovePartsCommand::undo() { - for (QGraphicsItem *qgi: moved_parts) qgi -> moveBy(-movement.x(), -movement.y()); + foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(-movement.x(), -movement.y()); } /// Refait le deplacement @@ -250,7 +250,7 @@ void MovePartsCommand::redo() { first_redo = false; return; } - for (QGraphicsItem *qgi: moved_parts) qgi -> moveBy(movement.x(), movement.y()); + foreach(QGraphicsItem *qgi, moved_parts) qgi -> moveBy(movement.x(), movement.y()); } /*** AddPartCommand ***/ @@ -353,7 +353,7 @@ ChangeZValueCommand::ChangeZValueCommand( QList items_list = editor_scene_ -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot); // prend un snapshot des zValues - for (QGraphicsItem *qgi: items_list) undo_hash.insert(qgi, qgi -> zValue()); + foreach(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() { - for (QGraphicsItem *qgi: undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]); + foreach(QGraphicsItem *qgi, undo_hash.keys()) qgi -> setZValue(undo_hash[qgi]); } /// Refait les changements de zValue void ChangeZValueCommand::redo() { - for (QGraphicsItem *qgi: redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]); + foreach(QGraphicsItem *qgi, redo_hash.keys()) qgi -> setZValue(redo_hash[qgi]); } /** @@ -392,15 +392,15 @@ void ChangeZValueCommand::redo() { void ChangeZValueCommand::applyBringForward(const QList &items_list) { QList non_selected_items = items_list; QList selected_items; - for (QGraphicsItem *qgi: non_selected_items) { + foreach(QGraphicsItem *qgi, non_selected_items) { if (qgi -> isSelected()) { selected_items << qgi; non_selected_items.removeAt(non_selected_items.indexOf(qgi)); } } int z = 1; - for (QGraphicsItem *qgi: non_selected_items) redo_hash.insert(qgi, z ++); - for (QGraphicsItem *qgi: selected_items) redo_hash.insert(qgi, z ++); + foreach(QGraphicsItem *qgi, non_selected_items) redo_hash.insert(qgi, z ++); + foreach(QGraphicsItem *qgi, selected_items) redo_hash.insert(qgi, z ++); } /** @@ -418,7 +418,7 @@ void ChangeZValueCommand::applyRaise(const QList &items_list) { } } int z = 1; - for (QGraphicsItem *qgi: my_items_list) redo_hash.insert(qgi, z ++); + foreach(QGraphicsItem *qgi, my_items_list) redo_hash.insert(qgi, z ++); } /** @@ -437,7 +437,7 @@ void ChangeZValueCommand::applyLower(const QList &items_list) { } int z = 1; - for (QGraphicsItem *qgi: my_items_list) redo_hash.insert(qgi, z ++); + foreach(QGraphicsItem *qgi, my_items_list) redo_hash.insert(qgi, z ++); } /** @@ -447,15 +447,15 @@ void ChangeZValueCommand::applyLower(const QList &items_list) { void ChangeZValueCommand::applySendBackward(const QList &items_list) { QList non_selected_items = items_list; QList selected_items; - for (QGraphicsItem *qgi: non_selected_items) { + foreach(QGraphicsItem *qgi, non_selected_items) { if (qgi -> isSelected()) { selected_items << qgi; non_selected_items.removeAt(non_selected_items.indexOf(qgi)); } } int z = 1; - for (QGraphicsItem *qgi: selected_items) redo_hash.insert(qgi, z ++); - for (QGraphicsItem *qgi: non_selected_items) redo_hash.insert(qgi, z ++); + foreach(QGraphicsItem *qgi, selected_items) redo_hash.insert(qgi, z ++); + foreach(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? - for (CustomElementPart *part_item: scaled_primitives_) { + foreach (CustomElementPart *part_item, scaled_primitives_) { part_item -> startUserTransformation(before); part_item -> handleUserTransformation(before, after); } diff --git a/sources/editor/elementprimitivedecorator.cpp b/sources/editor/elementprimitivedecorator.cpp index d04ff5de0..594508d85 100644 --- a/sources/editor/elementprimitivedecorator.cpp +++ b/sources/editor/elementprimitivedecorator.cpp @@ -58,7 +58,7 @@ QRectF ElementPrimitiveDecorator::internalBoundingRect() const { } } QRectF rect = decorated_items_.first() -> sceneGeometricRect(); - for (CustomElementPart *item: decorated_items_) { + foreach (CustomElementPart *item, decorated_items_) { rect = rect.united(item -> sceneGeometricRect()); } return(rect); @@ -146,7 +146,7 @@ void ElementPrimitiveDecorator::setItems(const QList &items */ void ElementPrimitiveDecorator::setItems(const QList &items) { QList primitives; - for (QGraphicsItem *item: items) { + foreach (QGraphicsItem *item, items) { if (CustomElementPart *part_item = dynamic_cast(item)) { primitives << part_item; } @@ -166,7 +166,7 @@ QList ElementPrimitiveDecorator::items() const { */ QList ElementPrimitiveDecorator::graphicsItems() const { QList list; - for (CustomElementPart *part_item: decorated_items_) { + foreach (CustomElementPart *part_item, decorated_items_) { if (QGraphicsItem *item = dynamic_cast(part_item)) { list << item; } @@ -410,7 +410,7 @@ void ElementPrimitiveDecorator::keyPressEvent(QKeyEvent *e) { } else { keys_movement_ += movement; } - for (QGraphicsItem *qgi: graphicsItems()) { + foreach(QGraphicsItem *qgi, graphicsItems()) { qgi -> setPos(qgi -> pos() + movement); adjust(); } @@ -469,7 +469,7 @@ void ElementPrimitiveDecorator::adjustEffectiveBoundingRect() { void ElementPrimitiveDecorator::startMovement() { adjust(); - for (CustomElementPart *item: decorated_items_) { + foreach(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; - for (QGraphicsItem *qgi: graphicsItems()) { + foreach(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(); - for (CustomElementPart *item: decorated_items_) { + foreach(CustomElementPart *item, decorated_items_) { item -> handleUserTransformation(scene_original_rect, scene_new_rect); } } diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index a1890c3c7..495d07a42 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -332,7 +332,7 @@ const QDomDocument ElementScene::toXml(bool all_parts) QDomElement description = xml_document.createElement("description"); //the graphic description of the element - for (QGraphicsItem *qgi: zItems()) + foreach(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; - for (QGraphicsItem *qgi: items()) { + foreach (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 { - for (QGraphicsItem *qgi:items()) { + foreach(QGraphicsItem *qgi,items()) { if (qgraphicsitem_cast(qgi)) { return(true); } @@ -515,7 +515,7 @@ QETElementEditor* ElementScene::editor() const { void ElementScene::slot_select(const ElementContent &content) { blockSignals(true); clearSelection(); - for (QGraphicsItem *qgi: content) qgi -> setSelected(true); + foreach(QGraphicsItem *qgi, content) qgi -> setSelected(true); blockSignals(false); emit(selectionChanged()); } @@ -539,7 +539,7 @@ void ElementScene::slot_deselectAll() { */ void ElementScene::slot_invertSelection() { blockSignals(true); - for (QGraphicsItem *qgi: items()) qgi -> setSelected(!qgi -> isSelected()); + foreach(QGraphicsItem *qgi, items()) qgi -> setSelected(!qgi -> isSelected()); blockSignals(false); emit(selectionChanged()); } @@ -698,7 +698,7 @@ void ElementScene::slot_sendBackward() { */ QList ElementScene::primitives() const { QList primitives_list; - for (QGraphicsItem *item: items()) { + foreach (QGraphicsItem *item, items()) { if (CustomElementPart *primitive = dynamic_cast(item)) { primitives_list << primitive; } @@ -768,7 +768,7 @@ QList ElementScene::zItems(ItemOptions options) const { */ ElementContent ElementScene::selectedContent() const { ElementContent content; - for (QGraphicsItem *qgi: zItems()) { + foreach(QGraphicsItem *qgi, zItems()) { if (qgi -> isSelected()) content << qgi; } return(content); @@ -796,7 +796,7 @@ void ElementScene::reset() clearSelection(); undoStack().clear(); - for (QGraphicsItem *qgi: items()) + foreach (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; - for (QGraphicsItem *qgi: content) { + foreach(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); - for (QGraphicsItem *part: content) { + foreach(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 - for (QGraphicsItem *part: content) { + foreach(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 - for (QGraphicsItem *qgi: items()) { + foreach (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()) { - for (QGraphicsView *view: views()) { + foreach (QGraphicsView *view, views()) { if (ElementView *element_view = dynamic_cast(view)) { command -> setElementView(element_view); break; diff --git a/sources/editor/graphicspart/customelementgraphicpart.cpp b/sources/editor/graphicspart/customelementgraphicpart.cpp index f74ab01fe..b28948316 100644 --- a/sources/editor/graphicspart/customelementgraphicpart.cpp +++ b/sources/editor/graphicspart/customelementgraphicpart.cpp @@ -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*$"); - for (QString style: styles) + foreach (QString style, styles) { if (!rx.exactMatch(style)) continue; QString style_name = rx.cap(1); diff --git a/sources/editor/graphicspart/customelementpart.cpp b/sources/editor/graphicspart/customelementpart.cpp index a19f7b67b..d2d046646 100644 --- a/sources/editor/graphicspart/customelementpart.cpp +++ b/sources/editor/graphicspart/customelementpart.cpp @@ -129,7 +129,7 @@ QList 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(); - for (QPointF point: points) { + foreach (QPointF point, points) { QPointF point_offset = point - initial_top_left; new_points << QPointF( new_top_left_x + (point_offset.rx() * sx), diff --git a/sources/editor/graphicspart/partarc.cpp b/sources/editor/graphicspart/partarc.cpp index 60fc2171b..09aaaad3f 100644 --- a/sources/editor/graphicspart/partarc.cpp +++ b/sources/editor/graphicspart/partarc.cpp @@ -133,7 +133,7 @@ QRectF PartArc::boundingRect() const { QRectF r = AbstractPartEllipse::boundingRect(); - for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect))) + foreach(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()) - for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect))) + foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect))) shape.addRect(rect); return shape; diff --git a/sources/editor/graphicspart/partellipse.cpp b/sources/editor/graphicspart/partellipse.cpp index 67b5a20fd..93f76486c 100644 --- a/sources/editor/graphicspart/partellipse.cpp +++ b/sources/editor/graphicspart/partellipse.cpp @@ -129,7 +129,7 @@ QRectF PartEllipse::boundingRect() const { QRectF r = AbstractPartEllipse::boundingRect(); - for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect))) + foreach(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()) - for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect))) + foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect))) shape.addRect(rect); return shape; diff --git a/sources/editor/graphicspart/partline.cpp b/sources/editor/graphicspart/partline.cpp index e953768c9..1985aae0f 100644 --- a/sources/editor/graphicspart/partline.cpp +++ b/sources/editor/graphicspart/partline.cpp @@ -244,7 +244,7 @@ QPainterPath PartLine::shape() const shape = pps.createStroke(shape); if (isSelected()) - for (QRectF rect: m_handler.handlerRect(m_handler.pointsForLine(m_line))) + foreach(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); - for (QPointF pointy: fourEndPoints(m_line.p1(), m_line.p2(), first_length)) + foreach(QPointF pointy, fourEndPoints(m_line.p1(), m_line.p2(), first_length)) painter -> drawEllipse(pointy, 0.1, 0.1); - for (QPointF pointy: fourEndPoints(m_line.p2(), m_line.p1(), second_length)) + foreach(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); - for (QRectF rect: m_handler.handlerRect(m_handler.pointsForLine(m_line))) + foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForLine(m_line))) bound |= rect; return bound; diff --git a/sources/editor/graphicspart/partpolygon.cpp b/sources/editor/graphicspart/partpolygon.cpp index 57426f691..09ef418eb 100644 --- a/sources/editor/graphicspart/partpolygon.cpp +++ b/sources/editor/graphicspart/partpolygon.cpp @@ -109,7 +109,7 @@ const QDomElement PartPolygon::toXml(QDomDocument &xml_document) const { QDomElement xml_element = xml_document.createElement("polygon"); int i = 1; - for (QPointF point: m_polygon) { + foreach(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()) - for (QRectF rect: m_handler.handlerRect(m_polygon)) + foreach(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); - for (QRectF rect: m_handler.handlerRect(m_polygon)) + foreach(QRectF rect, m_handler.handlerRect(m_polygon)) r |=rect; return(r); diff --git a/sources/editor/graphicspart/partrectangle.cpp b/sources/editor/graphicspart/partrectangle.cpp index 4a48db576..9c238df3b 100644 --- a/sources/editor/graphicspart/partrectangle.cpp +++ b/sources/editor/graphicspart/partrectangle.cpp @@ -165,7 +165,7 @@ QPainterPath PartRectangle::shape() const shape = pps.createStroke(shape); if (isSelected()) - for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect))) + foreach(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); - for (QRectF rect: m_handler.handlerRect(m_handler.pointsForRect(m_rect))) + foreach(QRectF rect, m_handler.handlerRect(m_handler.pointsForRect(m_rect))) r |= rect; return(r); diff --git a/sources/editor/polygoneditor.cpp b/sources/editor/polygoneditor.cpp index 5a5a8bb83..827799d65 100644 --- a/sources/editor/polygoneditor.cpp +++ b/sources/editor/polygoneditor.cpp @@ -101,7 +101,7 @@ void PolygonEditor::updateForm() { if (!part) return; activeConnections(false); while(points_list.takeTopLevelItem(0)) {} - for (QPointF point: part -> polygon()) { + foreach(QPointF point, part -> polygon()) { point = part -> mapToScene(point); QStringList qsl; qsl << QString("%1").arg(point.x()) << QString("%1").arg(point.y()); diff --git a/sources/editor/qetelementeditor.cpp b/sources/editor/qetelementeditor.cpp index d4c4ae092..ced331314 100644 --- a/sources/editor/qetelementeditor.cpp +++ b/sources/editor/qetelementeditor.cpp @@ -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); - for (QAction *action: parts -> actions()) action -> setCheckable(true); + foreach (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 - for (QAction *action: parts -> actions()) { + foreach (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); - for (QAction *action: m_depth_ag -> actions()) + foreach (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; - for (QGraphicsItem *qgi: selected_qgis) + foreach (QGraphicsItem *qgi, selected_qgis) { if (CustomElementPart *cep = dynamic_cast(qgi)) cep_list << cep; @@ -689,7 +689,7 @@ bool QETElementEditor::checkElement() { bool wrng = true; - for (CustomElementPart *cep: ce_scene->primitives()) + foreach (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; - for (QGraphicsItem *qgi: ce_scene->items()) + foreach(QGraphicsItem *qgi, ce_scene->items()) { if (qgraphicsitem_cast(qgi)) terminal ++; else if (qgraphicsitem_cast(qgi)) text ++; @@ -744,7 +744,7 @@ bool QETElementEditor::checkElement() dialog_message += "
    "; QList total = warnings << errors; - for (QETWarning warning: total) { + foreach(QETWarning warning, total) { dialog_message += "
  1. "; dialog_message += QString( tr("%1 : %2", "warning title: warning description") @@ -990,7 +990,7 @@ void QETElementEditor::addTerminal() { * Uncheck all action related to primitive */ void QETElementEditor::UncheckAddPrimitive() { - for (QAction *action: parts->actions()) action -> setChecked(false); + foreach(QAction *action, parts->actions()) action -> setChecked(false); } /** diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index 5a5aa96c9..27a1a0788 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -177,7 +177,7 @@ void StyleEditor::updateForm() size_weight -> setCurrentIndex(first_part -> lineWeight()); filling_color -> setCurrentIndex(first_part -> filling()); - for (CustomElementGraphicPart *cegp: m_part_list) + foreach (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 part_list) if (!isStyleEditable(part_list)) return false; - for (CustomElementPart *cep: part_list) + foreach (CustomElementPart *cep, part_list) { if (CustomElementGraphicPart *cegp = dynamic_cast(cep)) m_part_list << cegp; @@ -244,7 +244,7 @@ bool StyleEditor::setParts(QList part_list) return false; } - for (CustomElementGraphicPart *cegp: m_part_list) + foreach (CustomElementGraphicPart *cegp, m_part_list) m_cep_list << cegp; updateForm(); @@ -268,7 +268,7 @@ bool StyleEditor::isStyleEditable(QList cep_list) QStringList str; str << "arc" << "ellipse" << "line" << "polygon" << "rect"; - for (CustomElementPart *cep: cep_list) + foreach (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()) { - for (CustomElementGraphicPart *cegp: m_part_list) + foreach (CustomElementGraphicPart *cegp, m_part_list) { if (!undo) { diff --git a/sources/elementdialog.cpp b/sources/elementdialog.cpp index d989fb795..14f0d4e7c 100644 --- a/sources/elementdialog.cpp +++ b/sources/elementdialog.cpp @@ -89,7 +89,7 @@ void ElementDialog::setUpWidget() m_model = new ElementsCollectionModel(m_tree_view); QList prjs; - for (QETProject *prj: QETApp::registeredProjects()) + foreach(QETProject *prj, QETApp::registeredProjects()) prjs.append(prj); if (m_mode == OpenElement) diff --git a/sources/elementprovider.cpp b/sources/elementprovider.cpp index 70bf700d4..f0da971f4 100644 --- a/sources/elementprovider.cpp +++ b/sources/elementprovider.cpp @@ -52,11 +52,11 @@ QList ElementProvider::freeElement(const int filter) const{ QList free_elmt; //serch in all diagram - for (Diagram *d: diag_list) { + foreach (Diagram *d, diag_list) { //get all element in diagram d QList elmt_list; elmt_list = d->elements(); - for (Element *elmt: elmt_list) { + foreach (Element *elmt, elmt_list) { if (filter & elmt->linkType()) if (elmt->isFree()) free_elmt << elmt; } @@ -72,8 +72,8 @@ QList ElementProvider::freeElement(const int filter) const{ QList ElementProvider::fromUuids(QList uuid_list) const { QList found_element; - for (Diagram *d: diag_list) { - for (Element *elmt: d->elements()) { + foreach (Diagram *d, diag_list) { + foreach(Element *elmt, d->elements()) { if (uuid_list.contains(elmt->uuid())) { found_element << elmt; uuid_list.removeAll(elmt->uuid()); @@ -94,11 +94,11 @@ QList ElementProvider::find(const int filter) const { QList elmt_; //serch in all diagram - for (Diagram *d: diag_list) { + foreach (Diagram *d, diag_list) { //get all element in diagram d QList elmt_list; elmt_list = d->elements(); - for (Element *elmt: elmt_list) { + foreach (Element *elmt, elmt_list) { if (filter & elmt->linkType()) elmt_ << elmt; } diff --git a/sources/elementsmover.cpp b/sources/elementsmover.cpp index 332a6a312..6df1e7dd0 100644 --- a/sources/elementsmover.cpp +++ b/sources/elementsmover.cpp @@ -99,18 +99,18 @@ void ElementsMover::continueMovement(const QPointF &movement) { //Move every movable item, except conductor typedef DiagramContent dc; - for (QGraphicsItem *qgi: moved_content_.items(dc::Elements | dc::TextFields | dc::Images | dc::Shapes)) { + foreach (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 - for (Conductor *conductor: moved_content_.conductorsToMove) { + foreach(Conductor *conductor, moved_content_.conductorsToMove) { conductor -> setPos(conductor -> pos() + movement); } // Recalcul the path of other conductors - for (Conductor *conductor: moved_content_.conductorsToUpdate) { + foreach(Conductor *conductor, moved_content_.conductorsToUpdate) { conductor -> updatePath(); } } @@ -168,7 +168,7 @@ void ElementsMover::endMovement() { use_properties = true; others_properties = (*conductors_list.begin())->properties(); - for (Conductor *cond: conductors_list) + foreach (Conductor *cond, conductors_list) if (cond->properties() != others_properties) use_properties = false; } diff --git a/sources/elementspanel.cpp b/sources/elementspanel.cpp index aabde1b4a..2f898f395 100644 --- a/sources/elementspanel.cpp +++ b/sources/elementspanel.cpp @@ -238,7 +238,7 @@ void ElementsPanel::reload(bool reload_collections) { if (first_reload_) custom_tbt_collection_item_ -> setExpanded(true); // add projects - for (QETProject *project: projects_to_display_.values()) { + foreach(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) { - for (QTreeWidgetItem *item: items) { + foreach (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 - for (QTreeWidgetItem *qtwi: items) { + foreach (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() << "*******************"; - for ( QString filter , filter_list_ ) { + foreach( QString filter , filter_list_ ) { filter = filter.trimmed(); qDebug() << filter; } @@ -392,10 +392,10 @@ void ElementsPanel::applyCurrentFilter(const QList &items) { buildFilterList(); QList matching_items; - for (QTreeWidgetItem *item: items) { + foreach (QTreeWidgetItem *item, items) { bool item_matches = true; - for ( QString filter : filter_list_ ) { + foreach( QString filter , filter_list_ ) { filter = filter.trimmed(); if ( !filter.isEmpty() ) { item_matches &= matchesFilter(item, filter); @@ -414,19 +414,19 @@ void ElementsPanel::applyCurrentFilter(const QList &items) { void ElementsPanel::ensureHierarchyIsVisible(const QList &items) { // remonte l'arborescence pour lister les categories contenant les elements filtres QSet parent_items; - for (QTreeWidgetItem *item: items) { + foreach(QTreeWidgetItem *item, items) { for (QTreeWidgetItem *parent_qtwi = item -> parent() ; parent_qtwi ; parent_qtwi = parent_qtwi -> parent()) { parent_items << parent_qtwi; } } // etend les parents - for (QTreeWidgetItem *parent_qtwi: parent_items) { + foreach(QTreeWidgetItem *parent_qtwi, parent_items) { if (!parent_qtwi -> isExpanded()) parent_qtwi -> setExpanded(true); } // affiche les parents - for (QTreeWidgetItem *parent_qtwi: parent_items) { + foreach(QTreeWidgetItem *parent_qtwi, parent_items) { if (parent_qtwi -> isHidden()) parent_qtwi -> setHidden(false); } } diff --git a/sources/elementtextsmover.cpp b/sources/elementtextsmover.cpp index fb2565674..7ab0c9dd0 100644 --- a/sources/elementtextsmover.cpp +++ b/sources/elementtextsmover.cpp @@ -53,7 +53,7 @@ int ElementTextsMover::beginMovement(Diagram *diagram, QGraphicsItem *driver_ite movement_driver_ = driver_item; m_texts_item_H.clear(); - for (QGraphicsItem *item: diagram -> selectedItems()) + foreach(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; - for (ElementTextItem *text_item: m_texts_item_H.keys()) + foreach(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; - for (ElementTextItem *eti: m_texts_item_H.keys()) + foreach (ElementTextItem *eti, m_texts_item_H.keys()) { if (undo) { diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index bc41961af..21377ab83 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -110,7 +110,7 @@ ExportDialog::~ExportDialog() { */ int ExportDialog::diagramsToExportCount() const { int checked_diagrams_count = 0; - for (ExportDiagramLine *diagram_line: diagram_lines_.values()) { + foreach(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 - for (Diagram *diagram: project_ -> diagrams()) { + foreach (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() { - for (ExportDiagramLine *diagramLine: diagram_lines_) { + foreach (ExportDiagramLine *diagramLine, diagram_lines_) { diagramLine -> must_export -> setChecked(true); } } void ExportDialog::slot_deSelectAllClicked() { - for (ExportDiagramLine *diagramLine: diagram_lines_) { + foreach (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" - for (QGraphicsItem *qgi: diagram -> items()) { + foreach(QGraphicsItem *qgi, diagram -> items()) { if (Element *elmt = qgraphicsitem_cast(qgi)) { list_elements << elmt; } else if (Conductor *f = qgraphicsitem_cast(qgi)) { @@ -480,10 +480,10 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee } } - for (QetShapeItem *qsi: list_shapes) qsi->toDXF(file_path); + foreach (QetShapeItem *qsi, list_shapes) qsi->toDXF(file_path); //Draw elements - for (Element *elmt: list_elements) { + foreach(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 elmt_text = elmt -> texts(); - for (ElementTextItem *dti: elmt_text) { + foreach(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); - for (QString line: lines) { + foreach (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 elmt_line = elmt -> lines(); - for (QLineF *line: elmt_line) { + foreach(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 elmt_rectangle = elmt -> rectangles(); - for (QRectF *rect: elmt_rectangle) { + foreach(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 elmt_circle = elmt -> circles(); - for (QRectF *circle_rect: elmt_circle) { + foreach(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 *> elmt_polygon = elmt -> polygons(); - for (QVector *polygon: elmt_polygon) { + foreach(QVector *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 *> elmt_arc = elmt -> arcs(); - for (QVector *arc: elmt_arc) { + foreach(QVector *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 - for (Conductor *cond: list_conductors) { - for (ConductorSegment *segment: cond -> segmentsList()) { + foreach(Conductor *cond, list_conductors) { + foreach(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'); - for (QString line: lines) { + foreach (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 - for (DiagramTextItem *dti: list_texts) { + foreach(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'); - for (QString line: lines) { + foreach (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 diagrams_to_export; - for (ExportDiagramLine *diagram_line: diagram_lines_.values()) { + foreach(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 filenames; - for (ExportDiagramLine *diagram_line: diagrams_to_export) { + foreach(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 - for (ExportDiagramLine *diagram_line: diagrams_to_export) { + foreach(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 - for (int diagram_id: diagram_lines_.keys()) { + foreach(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 - for (ExportDiagramLine *diagram_line: diagram_lines_.values()) { + foreach(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 - for (QGraphicsItem *qgi: preview_scene -> items()) { + foreach (QGraphicsItem *qgi, preview_scene -> items()) { preview_scene -> removeItem(qgi); delete qgi; } diff --git a/sources/genericpanel.cpp b/sources/genericpanel.cpp index a38b98bfb..71dea2f8e 100644 --- a/sources/genericpanel.cpp +++ b/sources/genericpanel.cpp @@ -210,7 +210,7 @@ QTreeWidgetItem *GenericPanel::fillProjectItem(QTreeWidgetItem *project_qtwi, QE removeObsoleteItems(project -> diagrams(), project_qtwi, QET::Diagram, false); } int index = 0; - for (Diagram *diagram: project -> diagrams()) { + foreach (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; - for (QString template_name: tbt_collection -> templates()) { + foreach (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 GenericPanel::childItems(QTreeWidgetItem *item, QET::It template void GenericPanel::removeObsoleteItems(const QList &expected_items, QTreeWidgetItem *item, QET::ItemType type, bool recursive) { // remove items not found in expected_items - for (QTreeWidgetItem *child_item: childItems(item, type, recursive)) { + foreach (QTreeWidgetItem *child_item, childItems(item, type, recursive)) { T child_value = valueForItem(child_item); if (!expected_items.contains(child_value)) { deleteItem(child_item); diff --git a/sources/nameslistwidget.cpp b/sources/nameslistwidget.cpp index c934978d0..1ae8c9f59 100644 --- a/sources/nameslistwidget.cpp +++ b/sources/nameslistwidget.cpp @@ -133,7 +133,7 @@ NamesList NamesListWidget::names() { Definit les noms que le widget doit afficher */ void NamesListWidget::setNames(const NamesList &provided_names) { - for (QString lang: provided_names.langs()) { + foreach(QString lang, provided_names.langs()) { QString value = provided_names[lang]; QStringList values; values << lang << value; diff --git a/sources/nomenclature.cpp b/sources/nomenclature.cpp index 7ca7f70d6..0d44e51fd 100644 --- a/sources/nomenclature.cpp +++ b/sources/nomenclature.cpp @@ -103,7 +103,7 @@ QString nomenclature::getNomenclature() if(m_list_diagram.isEmpty()) return data; - for (Diagram *d: m_list_diagram) { + foreach (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); - for (Element *elmt: list_elements) { + foreach (Element *elmt, list_elements) { data += getElementInfo(elmt); } } diff --git a/sources/projectconfigpages.cpp b/sources/projectconfigpages.cpp index c25513d1c..949eb07b2 100644 --- a/sources/projectconfigpages.cpp +++ b/sources/projectconfigpages.cpp @@ -385,19 +385,19 @@ void ProjectAutoNumConfigPage::readValuesFromProject() { //Conductor Tab QList keys_conductor = m_project->conductorAutoNum().keys(); if (!keys_conductor.isEmpty()){ - for (QString str: keys_conductor) { m_context_cb_conductor-> addItem(str); } + foreach (QString str, keys_conductor) { m_context_cb_conductor-> addItem(str); } } //Element Tab QList keys_element = m_project->elementAutoNum().keys(); if (!keys_element.isEmpty()){ - for (QString str: keys_element) { m_context_cb_element -> addItem(str);} + foreach (QString str, keys_element) { m_context_cb_element -> addItem(str);} } //Folio Tab QList keys_folio = m_project->folioAutoNum().keys(); if (!keys_folio.isEmpty()){ - for (QString str: keys_folio) { m_context_cb_folio -> addItem(str);} + foreach (QString str, keys_folio) { m_context_cb_folio -> addItem(str);} } //Folio AutoNumbering Tab diff --git a/sources/projectview.cpp b/sources/projectview.cpp index 674dc67dc..309e1d0b1 100644 --- a/sources/projectview.cpp +++ b/sources/projectview.cpp @@ -55,7 +55,7 @@ ProjectView::ProjectView(QETProject *project, QWidget *parent) : */ ProjectView::~ProjectView() { // qDebug() << "Suppression du ProjectView" << ((void *)this); - for (int id: diagram_ids_.keys()) { + foreach(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 editors = QETApp::elementEditors(m_project); - for (QETElementEditor *editor: editors) { + foreach(QETElementEditor *editor, editors) { if (!editor -> close()) return(false); } QList template_editors = QETApp::titleBlockTemplateEditors(m_project); - for (QETTitleBlockTemplateEditor *template_editor: template_editors) { + foreach(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 - for (Diagram *d: m_project -> addNewDiagramFolioList()) { + foreach (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 &diagrams) { - for (Diagram *diagram: diagrams) { + foreach (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()); - for (Diagram *diagram: m_project -> diagrams()) { + foreach(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) { - for (DiagramView *diagram_view: diagrams()) { + foreach(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(); - for (DiagramView *diagram_view: m_diagram_view_list) { + foreach(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); diff --git a/sources/properties/xrefproperties.cpp b/sources/properties/xrefproperties.cpp index c6eb7885b..32560ed26 100644 --- a/sources/properties/xrefproperties.cpp +++ b/sources/properties/xrefproperties.cpp @@ -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); - for (QString key: m_prefix.keys()) { + foreach (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(); - for (QString key: m_prefix_keys) { + foreach (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); - for (QString key: m_prefix.keys()) { + foreach (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)"); - for (QString key: m_prefix_keys) { + foreach (QString key, m_prefix_keys) { m_prefix.insert(key, xml_element.attribute(key + "prefix")); } } @@ -132,7 +132,7 @@ QHash XRefProperties::defaultProperties() QSettings settings; - for (QString key: keys) + foreach (QString key, keys) { XRefProperties properties; QString str("diagrameditor/defaultxref"); diff --git a/sources/qet.cpp b/sources/qet.cpp index c7363e9dc..cfc3c6c31 100644 --- a/sources/qet.cpp +++ b/sources/qet.cpp @@ -398,7 +398,7 @@ QString QET::stringToFileName(const QString &name) { QString file_name(name.toLower()); // remplace les caracteres interdits par des tirets - for (QChar c: QET::forbiddenCharacters()) { + foreach(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; - for (QString escaped_string: escaped_strings) { + foreach(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; - for (const QString t: qsl) { + foreach (const QString t, qsl) { if (qsl.at(0) != t) return false; } return true; diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 0ffc82569..1b7f23dfe 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -360,7 +360,7 @@ QList QETApp::availableTitleBlockTemplatesColle collections_list << common_tbt_collection_; collections_list << custom_tbt_collection_; - for (QETProject *opened_project: registered_projects_) { + foreach(QETProject *opened_project, registered_projects_) { collections_list << opened_project -> embeddedTitleBlockTemplatesCollection(); } @@ -582,7 +582,7 @@ QStringList QETApp::handledFileExtensions() { */ QStringList QETApp::handledFiles(const QList &urls) { QList filepaths; - for (QUrl url: urls) { + foreach (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()); - for (QETDiagramEditor *diagram_editor: qet_app -> diagramEditors()) { + foreach (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) { - for (QETDiagramEditor *qde: QETApp::diagramEditors()) { + foreach (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(); - for (QETProject *project: registered_projects_) { + foreach(QETProject *project, registered_projects_) { project -> close(); } bool every_window_closed = true; - for (QETDiagramEditor *e: diagramEditors()) { + foreach(QETDiagramEditor *e, diagramEditors()) { every_window_closed = every_window_closed && e -> close(); } - for (QETElementEditor *e: elementEditors()) { + foreach(QETElementEditor *e, elementEditors()) { every_window_closed = every_window_closed && e -> close(); } return(every_window_closed); @@ -782,8 +782,8 @@ QList QETApp::titleBlockTemplateEditors(QETProjec QList editors; if (!project) return(editors); - // for known template editor - for (QETTitleBlockTemplateEditor *tbt_editor: titleBlockTemplateEditors()) { + // foreach known template editor + foreach (QETTitleBlockTemplateEditor *tbt_editor, titleBlockTemplateEditors()) { if (tbt_editor -> location().parentProject() == project) { editors << tbt_editor; } @@ -839,7 +839,7 @@ QList QETApp::elementEditors(QETProject *project) { if (!project) return(editors); // pour chaque editeur d'element... - for (QETElementEditor *elmt_editor: elementEditors()) { + foreach(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 QList QETApp::detectWindows() const { QList windows; - for (QWidget *widget: topLevelWidgets()) { + foreach(QWidget *widget, topLevelWidgets()) { if (!widget -> isWindow()) continue; if (T *window = qobject_cast(widget)) { windows << window; @@ -881,7 +881,7 @@ template QList QETApp::detectWindows() const { @param visible whether detected main windows should be visible */ template void QETApp::setMainWindowsVisible(bool visible) { - for (T *e: detectWindows()) { + foreach(T *e, detectWindows()) { 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 - for (QWidget *qw: floatingToolbarsAndDocksForMainWindow(window)) { + foreach (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 visible_diagrams_editors; - for (QETDiagramEditor *de: diagrams_editors) { + foreach(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 - for (QString file: files_list) { + foreach(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 files_set; - for (QString file: files_list) { + foreach(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 element_editors = elementEditors(); // on traite les fichiers a la queue leu leu... - for (QString element_file: files_set) { + foreach(QString element_file, files_set) { bool already_opened_in_existing_element_editor = false; - for (QETElementEditor *element_editor: element_editors) { + foreach(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 &locations_list) QList element_editors = elementEditors(); // on traite les emplacements a la queue leu leu... - for (ElementsLocation element_location: locations_list) { + foreach(ElementsLocation element_location, locations_list) { bool already_opened_in_existing_element_editor = false; - for (QETElementEditor *element_editor: element_editors) { + foreach(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 files_set; - for (QString file: files_list) { + foreach (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 tbt_editors = titleBlockTemplateEditors(); - for (QString tbt_file: files_set) { + foreach(QString tbt_file, files_set) { bool already_opened_in_existing_tbt_editor = false; - for (QETTitleBlockTemplateEditor *tbt_editor: tbt_editors) { + foreach(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 QETApp::floatingToolbarsAndDocksForMainWindow(QMainWindow *window) const { QList widgets; - for (QWidget *qw: topLevelWidgets()) { + foreach(QWidget *qw, topLevelWidgets()) { if (!qw -> isWindow()) continue; if (qobject_cast(qw) || qobject_cast(qw)) { if (qw -> parent() == window) widgets << qw; @@ -1455,7 +1455,7 @@ void QETApp::initSystemTray() { */ template void QETApp::addWindowsListToMenu(QMenu *menu, const QList &windows) { menu -> addSeparator(); - for (QMainWindow *window: windows) { + foreach (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; - for (QMainWindow *w: diagrams) if (w -> isVisible()) ++ visible_diagrams; + foreach(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; - for (QMainWindow *w: elements) if (w -> isVisible()) ++ visible_elements; + foreach(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; - for (QMainWindow *window: tbtemplates) { + foreach(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) { - for (int id: registered_projects_.keys()) { + foreach(int id, registered_projects_.keys()) { if (registered_projects_[id] == project) { return(id); } diff --git a/sources/qetarguments.cpp b/sources/qetarguments.cpp index 297898065..ca92439a1 100644 --- a/sources/qetarguments.cpp +++ b/sources/qetarguments.cpp @@ -193,7 +193,7 @@ void QETArguments::parseArguments(const QList &arguments) { clear(); // separe les fichiers des options - for (QString argument: arguments) { + foreach(QString argument, arguments) { QFileInfo argument_info(argument); if (argument_info.exists()) { // on exprime les chemins des fichiers en absolu diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index a8e952fd8..372e36d8b 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -111,7 +111,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) : if (files.count()) { //So we open this files - for (QString file: files) + foreach(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) { - for (ProjectView *prjv: this->openedProjects()) - for (Diagram *d: prjv->project()->diagrams()) { + foreach (ProjectView *prjv, this->openedProjects()) + foreach (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"); - for (QAction *action: m_add_item_actions_group.actions()) action->setCheckable(true); + foreach (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 - for (ProjectView *project: openedProjects()) { + foreach(ProjectView *project, openedProjects()) { if (!closeProject(project)) { can_quit = false; qce -> ignore(); @@ -985,7 +985,7 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) { QList QETDiagramEditor::openedProjects() const { QList result; QList window_list(workspace.subWindowList()); - for (QMdiSubWindow *window: window_list) { + foreach(QMdiSubWindow *window, window_list) { if (ProjectView *project_view = qobject_cast(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 { - for (ProjectView *project_view: openedProjects()) { + foreach(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 { - for (ProjectView *project_view: openedProjects()) { - for (DiagramView *diagram_view: project_view -> diagrams()) { + foreach(ProjectView *project_view, openedProjects()) { + foreach(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 { - for (ProjectView *opened_project: openedProjects()) { + foreach(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 { - for (ProjectView *opened_project: openedProjects()) { + foreach(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 { - for (QMdiSubWindow *sub_window: workspace.subWindowList()) { + foreach(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()) - for (DiagramView *dv: pv -> diagrams()) + foreach(DiagramView *dv, pv -> diagrams()) dv -> setSelectionMode(); } @@ -1295,7 +1295,7 @@ void QETDiagramEditor::slot_setSelectionMode() void QETDiagramEditor::slot_setVisualisationMode() { if (ProjectView *pv = currentProject()) - for (DiagramView *dv: pv -> diagrams()) + foreach(DiagramView *dv, pv -> diagrams()) dv -> setVisualisationMode(); } @@ -1506,7 +1506,7 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view) { if (!project_view) return; - for (DiagramView *dv: project_view -> diagrams()) + foreach(DiagramView *dv, project_view -> diagrams()) diagramWasAdded(dv); //Manage the close event of project @@ -1543,7 +1543,7 @@ void QETDiagramEditor::addProjectView(ProjectView *project_view) */ QList QETDiagramEditor::editedFiles() const { QList edited_files_list; - for (ProjectView *project_view: openedProjects()) { + foreach (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); } - for (ProjectView *project_view: openedProjects()) { + foreach (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 - for (QAction *a: windows_menu -> actions()) windows_menu -> removeAction(a); + foreach(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); - for (ProjectView *project_view: windows) { + foreach(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) { - for (DiagramView *diag: current_project -> diagrams()) { + foreach (DiagramView *diag, current_project -> diagrams()) { if (dynamic_cast(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) { - for (DiagramView *diag: current_project -> diagrams()) { + foreach (DiagramView *diag, current_project -> diagrams()) { DiagramFolioList *ptr = dynamic_cast(diag -> diagram()); if (ptr && ptr -> getId() == current_project -> project() -> getFolioSheetsQuantity() - 1) { current_project -> removeDiagram(diag); diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index 2ab49d89e..9fc15a632 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -280,13 +280,13 @@ QHash Conductor::shareOffsetBetweenSegments( ) const { // construit le QHash qui sera retourne QHash segments_hash; - for (ConductorSegmentProfile *csp: segments_list) { + foreach(ConductorSegmentProfile *csp, segments_list) { segments_hash.insert(csp, csp -> length); } // memorise le signe de la longueur de chaque segement QHash segments_signs; - for (ConductorSegmentProfile *csp: segments_hash.keys()) { + foreach(ConductorSegmentProfile *csp, segments_hash.keys()) { segments_signs.insert(csp, getSign(csp -> length)); } @@ -297,12 +297,12 @@ QHash Conductor::shareOffsetBetweenSegments( while (remaining_offset > precision || remaining_offset < -precision) { // recupere le nombre de segments differents ayant une longueur non nulle uint segments_count = 0; - for (ConductorSegmentProfile *csp: segments_hash.keys()) if (segments_hash[csp]) ++ segments_count; + foreach(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; - for (ConductorSegmentProfile *csp: segments_hash.keys()) { + foreach(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); - for (QPointF point: junctions_list) { + foreach(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()) { -// for (QRectF rect, m_handler.handlerRect(handlerPoints())) { +// foreach (QRectF rect, m_handler.handlerRect(handlerPoints())) { // shape_.addRect(rect); // } // } @@ -792,7 +792,7 @@ uint Conductor::segmentsCount(QET::ConductorSegmentType type) const { QList segments_list = segmentsList(); if (type == QET::Both) return(segments_list.count()); uint nb_seg = 0; - for (ConductorSegment *conductor_segment: segments_list) { + foreach(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 { // parcours et export des segments QDomElement current_segment; - for (ConductorSegment *segment: segmentsList()) + foreach(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; - for (qreal t: segments_x) width += t; - for (qreal t: segments_y) height += t; + foreach (qreal t, segments_x) width += t; + foreach (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 Conductor::handlerPoints() const QVector middle_points; - for (ConductorSegment *segment: sl) + foreach(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 - for (Conductor *c: relatedPotentialConductors(false)) { + foreach (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 potential_list = relatedPotentialConductors(); - for (Conductor *other_conductor: potential_list) + foreach(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")); - for (Conductor *potential_conductor: relatedPotentialConductors()) + foreach (Conductor *potential_conductor, relatedPotentialConductors()) { old_value.setValue(potential_conductor->properties()); ConductorProperties new_properties = potential_conductor->properties(); @@ -1436,7 +1436,7 @@ QSet Conductor::relatedPotentialConductors(const bool all_diagram, this_terminal << terminal1 << terminal2; // Return all conductor of terminal 1 and 2 - for (Terminal *terminal: this_terminal) { + foreach (Terminal *terminal, this_terminal) { if (!t_list -> contains(terminal)) { t_list -> append(terminal); QList other_conductors_list_t = terminal -> conductors(); @@ -1450,7 +1450,7 @@ QSet Conductor::relatedPotentialConductors(const bool all_diagram, other_conductors_list_t.removeAll(this); // Research the conductors connected to conductors already found - for (Conductor *c: other_conductors_list_t) { + foreach (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 Conductor::junctions() const { // determine si le point est une bifurcation ou non bool is_bend = false; Qt::Corner current_bend_type = Qt::TopLeftCorner; - for (ConductorBend cb: bends_list) { + foreach(ConductorBend cb, bends_list) { if (cb.first == point) { is_bend = true; current_bend_type = cb.second; @@ -1566,7 +1566,7 @@ QList Conductor::junctions() const { bool is_junction = false; QPointF scene_point = mapToScene(point); - for (Conductor *c: other_conductors) { + foreach(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 Conductor::junctions() const { is_junction = true; // ce point commun ne doit pas etre une bifurcation identique a celle-ci QList other_conductor_bends = c -> bends(); - for (ConductorBend cb: other_conductor_bends) { + foreach(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 polygons = polygon.simplified().toSubpathPolygons(); QList lines; QList points; - for (QPolygonF polygon: polygons) { + foreach(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 intersections; - for (QLineF line: lines) { + foreach (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 - for (Conductor *c: conductor -> relatedPotentialConductors(all_diagram)) + foreach (Conductor *c, conductor -> relatedPotentialConductors(all_diagram)) if (c -> length() > longuest_conductor -> length()) longuest_conductor = c; diff --git a/sources/qetgraphicsitem/crossrefitem.cpp b/sources/qetgraphicsitem/crossrefitem.cpp index d875a95d9..135a57bd4 100644 --- a/sources/qetgraphicsitem/crossrefitem.cpp +++ b/sources/qetgraphicsitem/crossrefitem.cpp @@ -209,7 +209,7 @@ void CrossRefItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) m_hovered_contact->setSelected(true); //Zoom to the linked slave element - for (QGraphicsView *view: m_hovered_contact->diagram()->views()) + foreach(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) { - for (QRectF rect: m_hovered_contacts_map.values(m_hovered_contact)) + foreach(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; - for (Element *elmt: m_hovered_contacts_map.keys()) + foreach (Element *elmt, m_hovered_contacts_map.keys()) { - for (QRectF rect: m_hovered_contacts_map.values(elmt)) + foreach(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 { - for (Element *elmt: m_hovered_contacts_map.keys()) + foreach (Element *elmt, m_hovered_contacts_map.keys()) { - for (QRectF rect: m_hovered_contacts_map.values(elmt)) + foreach(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; - for (Element *elmt: NOElements()) + foreach (Element *elmt, NOElements()) no_str.append(elementPositionText(elmt, true)); - for (Element *elmt: NCElements()) + foreach(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; - for (QString str: no_str) + foreach(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; - for (QString str: nc_str) + foreach(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 - for (Element *elmt: m_element->linkedElements()) + foreach (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); - for (Element *elmt: NOElements()) + foreach(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); - for (Element *elmt: NCElements()) + foreach(Element *elmt, NCElements()) { QPen pen = painter.pen(); m_hovered_contact == elmt ? pen.setColor(Qt::blue) :pen.setColor(Qt::black); @@ -731,7 +731,7 @@ QList CrossRefItem::NOElements() const { QList no_list; - for (Element *elmt: m_element->linkedElements()) + foreach (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 CrossRefItem::NCElements() const { QList nc_list; - for (Element *elmt: m_element->linkedElements()) + foreach (Element *elmt, m_element->linkedElements()) { //We continue if element is a power contact and xref propertie //is set to don't show power contact diff --git a/sources/qetgraphicsitem/customelement.cpp b/sources/qetgraphicsitem/customelement.cpp index 5c552d9a8..1c1bc15ce 100644 --- a/sources/qetgraphicsitem/customelement.cpp +++ b/sources/qetgraphicsitem/customelement.cpp @@ -211,7 +211,7 @@ QList CustomElement::terminals() const { /// @return la liste des conducteurs rattaches a cet element QList CustomElement::conductors() const { QList conductors; - for (Terminal *t: list_terminals) conductors << t -> conductors(); + foreach(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*$"); - for (QString style: styles) { + foreach (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 { - for (ElementTextItem *eti: list_texts_) { + foreach (ElementTextItem *eti, list_texts_) { if (eti -> tagg() == tagg) return eti; } return NULL; diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index cabc387fe..e68eaab5b 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -115,7 +115,7 @@ void Element::setHighlighted(bool hl) { */ void Element::displayHelpLine(bool b) { - for (Terminal *t: terminals()) + foreach (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 - for (QGraphicsItem *qgi: childItems()) { + foreach(QGraphicsItem *qgi, childItems()) { if (Terminal *p = qgraphicsitem_cast(qgi)) { p -> updateConductor(); } } // repositionne les textes de l'element qui ne comportent pas l'option "FollowParentRotations" - for (ElementTextItem *eti: texts()) { + foreach(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 &table_id_adr, bool ce recensement servira lors de la mise en place des fils */ QList liste_terminals; - for (QDomElement qde: QET::findInDomElement(e, "terminals", "terminal")) { + foreach(QDomElement qde, QET::findInDomElement(e, "terminals", "terminal")) { if (Terminal::valideXml(qde)) liste_terminals << qde; } QHash priv_id_adr; int terminals_non_trouvees = 0; - for (QGraphicsItem *qgi: childItems()) { + foreach(QGraphicsItem *qgi, childItems()) { if (Terminal *p = qgraphicsitem_cast(qgi)) { bool terminal_trouvee = false; - for (QDomElement qde: liste_terminals) { + foreach(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 &table_id_adr, bool return(false); } else { // verifie que les associations id / adr n'entrent pas en conflit avec table_id_adr - for (int id_trouve: priv_id_adr.keys()) { + foreach(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 - for (int id_trouve: priv_id_adr.keys()) { + foreach(int id_trouve, priv_id_adr.keys()) { table_id_adr.insert(id_trouve, priv_id_adr.value(id_trouve)); } } //import text filed value QList inputs = QET::findInDomElement(e, "inputs", "input"); - for (QGraphicsItem *qgi: childItems()) + foreach(QGraphicsItem *qgi, childItems()) { if (ElementTextItem *eti = qgraphicsitem_cast(qgi)) { - for (QDomElement input: inputs) + foreach(QDomElement input, inputs) { eti -> fromXml(input); etiToElementLabels(eti); @@ -454,7 +454,7 @@ bool Element::fromXml(QDomElement &e, QHash &table_id_adr, bool //load uuid of connected elements QList uuid_list = QET::findInDomElement(e, "links_uuids", "link_uuid"); - for (QDomElement qdo: uuid_list) tmp_uuids_link << qdo.attribute("uuid"); + foreach (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 &table if (!table_adr_id.isEmpty()) { // trouve le plus grand id int max_id_t = -1; - for (int id_t: table_adr_id.values()) { + foreach (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 &table // enregistrement des bornes de l'appareil QDomElement xml_terminals = document.createElement("terminals"); // pour chaque enfant de l'element - for (Terminal *t: terminals()) { + foreach(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 &table // enregistrement des champ de texte de l'appareil QDomElement inputs = document.createElement("inputs"); - for (ElementTextItem *eti: texts()) { + foreach(ElementTextItem *eti, texts()) { inputs.appendChild(eti -> toXml(document)); } element.appendChild(inputs); @@ -569,7 +569,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash &table //save the uuid of each other elements if (! isFree()) { QDomElement links_uuids = document.createElement("links_uuids"); - for (Element *elmt: connected_elements) { + foreach (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 > Element::AlignedFreeTerminals() const { QList > list; - for (Terminal *terminal: terminals()) + foreach (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); - for (Element *elmt: ep.fromUuids(tmp_uuids_link)) { + foreach (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); - for (Terminal *t: terminals()) + foreach (Terminal *t, terminals()) { t -> drawHelpLine(true); } @@ -689,7 +689,7 @@ void Element::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { QetGraphicsItem::mouseReleaseEvent(event); - for (Terminal *t: terminals()) + foreach (Terminal *t, terminals()) { t -> drawHelpLine(false); } @@ -704,7 +704,7 @@ void Element::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void Element::hoverEnterEvent(QGraphicsSceneHoverEvent *e) { Q_UNUSED(e); - for (Element *elmt: linkedElements()) + foreach (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); - for (Element *elmt: linkedElements()) + foreach (Element *elmt, linkedElements()) elmt -> setHighlighted(false); m_mouse_over = false; diff --git a/sources/qetgraphicsitem/elementtextitem.cpp b/sources/qetgraphicsitem/elementtextitem.cpp index 2300a06d8..74ef72fe2 100644 --- a/sources/qetgraphicsitem/elementtextitem.cpp +++ b/sources/qetgraphicsitem/elementtextitem.cpp @@ -210,7 +210,7 @@ void ElementTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) linked -> setSelected(true); //Zoom to the linked element - for (QGraphicsView *view: linked -> diagram() -> views()) { + foreach(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()) - for (QGraphicsItem *qgi: childItems()) + foreach (QGraphicsItem *qgi, childItems()) if (QGraphicsTextItem *qgti = qgraphicsitem_cast (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()) - for (QGraphicsItem *qgi: childItems()) + foreach (QGraphicsItem *qgi, childItems()) if (QGraphicsTextItem *qgti = qgraphicsitem_cast (qgi)) qgti -> setDefaultTextColor(Qt::black); } diff --git a/sources/qetgraphicsitem/ghostelement.cpp b/sources/qetgraphicsitem/ghostelement.cpp index 84bd17a68..2ab44746c 100644 --- a/sources/qetgraphicsitem/ghostelement.cpp +++ b/sources/qetgraphicsitem/ghostelement.cpp @@ -58,7 +58,7 @@ bool GhostElement::fromXml(QDomElement &e, QHash &table_id_adr, terminalsFromXml(e, table_id_adr); // instancie les champs de texte decrits dans l'element XML - for (QDomElement qde: QET::findInDomElement(e, "inputs", "input")) { + foreach(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 &table_id_adr) { // instancie les bornes decrites dans l'element XML - for (QDomElement qde: QET::findInDomElement(e, "terminals", "terminal")) { + foreach(QDomElement qde, QET::findInDomElement(e, "terminals", "terminal")) { if (!Terminal::valideXml(qde)) continue; // modifie certains attributs pour que l'analyse par la classe CustomElement reussisse diff --git a/sources/qetgraphicsitem/masterelement.cpp b/sources/qetgraphicsitem/masterelement.cpp index a85079dd8..34f707c39 100644 --- a/sources/qetgraphicsitem/masterelement.cpp +++ b/sources/qetgraphicsitem/masterelement.cpp @@ -79,7 +79,7 @@ void MasterElement::unlinkAllElements() // if this element is free no need to do something if (!isFree()) { - for (Element *elmt: connected_elements) + foreach(Element *elmt, connected_elements) unlinkElement(elmt); emit linkedElementChanged(); } diff --git a/sources/qetgraphicsitem/qetgraphicsitem.cpp b/sources/qetgraphicsitem/qetgraphicsitem.cpp index 739ff985f..4ea4e8853 100644 --- a/sources/qetgraphicsitem/qetgraphicsitem.cpp +++ b/sources/qetgraphicsitem/qetgraphicsitem.cpp @@ -96,7 +96,7 @@ void QetGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *e) { //Disable views context menu if (scene()) - for (QGraphicsView *view: scene()->views()) + foreach (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()) - for (QGraphicsView *view: scene()->views()) + foreach (QGraphicsView *view, scene()->views()) view -> setContextMenuPolicy(Qt::DefaultContextMenu); } diff --git a/sources/qetgraphicsitem/qetshapeitem.cpp b/sources/qetgraphicsitem/qetshapeitem.cpp index 7647f94ca..2f1d6e4d6 100644 --- a/sources/qetgraphicsitem/qetshapeitem.cpp +++ b/sources/qetgraphicsitem/qetshapeitem.cpp @@ -259,7 +259,7 @@ QPainterPath QetShapeItem::shape() const else vector = m_polygon; - for (QRectF r: m_handler.handlerRect(vector)) + foreach(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 - for (QDomElement de: QET::findInDomElement(e, "points", "point")) + foreach(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"); - for (QPointF p: m_polygon) + foreach(QPointF p, m_polygon) { QDomElement point = document.createElement("point"); QPointF pf = mapToScene(p); diff --git a/sources/qetgraphicsitem/reportelement.cpp b/sources/qetgraphicsitem/reportelement.cpp index a81968617..61effaeb6 100644 --- a/sources/qetgraphicsitem/reportelement.cpp +++ b/sources/qetgraphicsitem/reportelement.cpp @@ -122,7 +122,7 @@ void ReportElement::unlinkAllElements() QList tmp_elmt = connected_elements; - for (Element *elmt: connected_elements) + foreach(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(); - for (Element *elmt: tmp_elmt) + foreach(Element *elmt, tmp_elmt) { elmt -> setHighlighted(false); elmt -> unlinkAllElements(); diff --git a/sources/qetgraphicsitem/slaveelement.cpp b/sources/qetgraphicsitem/slaveelement.cpp index 24131f4bd..dca6ee474 100644 --- a/sources/qetgraphicsitem/slaveelement.cpp +++ b/sources/qetgraphicsitem/slaveelement.cpp @@ -83,7 +83,7 @@ void SlaveElement::unlinkAllElements() // if this element is free no need to do something if (!isFree()) { - for (Element *elmt: connected_elements) + foreach(Element *elmt, connected_elements) unlinkElement(elmt); emit linkedElementChanged(); } diff --git a/sources/qetgraphicsitem/terminal.cpp b/sources/qetgraphicsitem/terminal.cpp index 975d6f9ab..28535ed43 100644 --- a/sources/qetgraphicsitem/terminal.cpp +++ b/sources/qetgraphicsitem/terminal.cpp @@ -134,7 +134,7 @@ Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bo associes. */ Terminal::~Terminal() { - for (Conductor *c: conductors_) delete c; + foreach(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 - for (Conductor* cond: conductors_) + foreach (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 qgi_list = diagram() -> items(path); //Remove all terminals of the parent element - for (Terminal *t: parent_element_ -> terminals()) + foreach (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 available_terminals; - for (QGraphicsItem *qgi: qgi_list) + foreach (QGraphicsItem *qgi, qgi_list) { if (Terminal *tt = qgraphicsitem_cast (qgi)) { @@ -448,7 +448,7 @@ Terminal* Terminal::alignedWithTerminal() const Terminal *nearest_terminal = available_terminals.takeFirst(); //Search the nearest terminal to this one - for (Terminal *terminal: available_terminals) + foreach (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(); - for (Conductor *conductor: conductors_list) { + foreach (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() { - for (Conductor *conductor: conductors_) + foreach (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; - for (Conductor *c: conductors_) { + foreach (Conductor *c, conductors_) { if (c -> terminal1 == other_terminal || c -> terminal2 == other_terminal) { already_linked = true; break; diff --git a/sources/qetmainwindow.cpp b/sources/qetmainwindow.cpp index 9a39aace7..50c341e8c 100644 --- a/sources/qetmainwindow.cpp +++ b/sources/qetmainwindow.cpp @@ -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 - for (QETDiagramEditor *qde: qet_app->diagramEditors()) + foreach (QETDiagramEditor *qde, qet_app->diagramEditors()) qde->reloadOldElementPanel(); }); diff --git a/sources/qetprintpreviewdialog.cpp b/sources/qetprintpreviewdialog.cpp index 6413ecd3c..f684a1724 100644 --- a/sources/qetprintpreviewdialog.cpp +++ b/sources/qetprintpreviewdialog.cpp @@ -408,7 +408,7 @@ void QETPrintPreviewDialog::updateZoomList() { int current_zoom_index = -1; zoom_box_ -> blockSignals(true); zoom_box_ -> clear(); - for (qreal z: zooms_real) { + foreach (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; } diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index 1cb7acbf2..beb3c2613 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -737,7 +737,7 @@ QDomDocument QETProject::toXml() { // titleblock templates, if any if (titleblocks_.templates().count()) { QDomElement titleblocktemplates_elmt = xml_doc.createElement("titleblocktemplates"); - for (QString template_name: titleblocks_.templates()) { + foreach (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; - for (Diagram *diagram: diagrams_) { + foreach(Diagram *diagram, diagrams_) { // Write the diagram to XML only if it is not of type DiagramFolioList. DiagramFolioList *ptr = dynamic_cast(diagram); @@ -848,7 +848,7 @@ bool QETProject::isEmpty() const { // compte le nombre de schemas non vides int pertinent_diagrams = 0; - for (Diagram *diagram: diagrams_) { + foreach(Diagram *diagram, diagrams_) { if (!diagram -> isEmpty()) ++ pertinent_diagrams; } @@ -988,7 +988,7 @@ QString QETProject::integrateTitleBlockTemplate(const TitleBlockTemplateLocation */ bool QETProject::usesElement(const ElementsLocation &location) const { - for (Diagram *diagram: diagrams()) { + foreach(Diagram *diagram, diagrams()) { if (diagram -> usesElement(location)) { return(true); } @@ -1007,7 +1007,7 @@ QList QETProject::unusedElements() const { QList unused_list; - for (ElementsLocation location: m_elements_collection->elementsLocation()) + foreach(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); - for (Diagram *diagram: diagrams()) { + foreach (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 - for (Diagram *diagram: loaded_diagrams.values()) + foreach(Diagram *diagram, loaded_diagrams.values()) addDiagram(diagram); //Initialise links between elements in this project //and refresh the text of conductor - for (Diagram *d: diagrams()) + foreach (Diagram *d, diagrams()) d->refreshContents(); delete dlgWaiting; @@ -1323,7 +1323,7 @@ void QETProject::readElementsCollectionXml(QDomDocument &xml_project) */ void QETProject::readProjectPropertiesXml(QDomDocument &xml_project) { - for (QDomElement e: QET::findInDomElement(xml_project.documentElement(), "properties")) + foreach (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()) { - for (QDomElement elmt: QET::findInDomElement(xref_elmt, "xref")) + foreach(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"; - for (QDomElement elmt: QET::findInDomElement(conds_autonums, "conductor_autonum")) + foreach (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()) { - for (QDomElement elmt: QET::findInDomElement(folio_autonums, "folio_autonum")) + foreach (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"; - for (QDomElement elmt: QET::findInDomElement(element_autonums, "element_autonum")) + foreach (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"); - for (QString key: defaultXRefProperties().keys()) { + foreach (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"); - for (QString key: conductorAutoNum().keys()) { + foreach (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"); - for (QString key: folioAutoNum().keys()) { + foreach (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"); - for (QString key: elementAutoNum().keys()) { + foreach (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) - for (Diagram *diagram: diagrams_) { + foreach (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 - for (Diagram *diagram: diagrams_) { + foreach (Diagram *diagram, diagrams_) { diagram -> titleBlockTemplateRemoved(template_name); } } diff --git a/sources/qgimanager.cpp b/sources/qgimanager.cpp index a68d49f4d..2f835b4b4 100644 --- a/sources/qgimanager.cpp +++ b/sources/qgimanager.cpp @@ -36,7 +36,7 @@ QGIManager::QGIManager(QGraphicsScene *sc) : */ QGIManager::~QGIManager(){ if (!destroy_qgi_on_delete) return; - for (QGraphicsItem *qgi: qgi_manager.keys()) { + foreach(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 &qgis) { - for (QGraphicsItem *qgi: qgis) manage(qgi); + foreach(QGraphicsItem *qgi, qgis) manage(qgi); } /** @@ -82,7 +82,7 @@ void QGIManager::manage(const QList &qgis) { @param qgis QGraphicsItems a ne plus gerer */ void QGIManager::release(const QList &qgis) { - for (QGraphicsItem *qgi: qgis) release(qgi); + foreach(QGraphicsItem *qgi, qgis) release(qgi); } /** diff --git a/sources/qtextorientationwidget.cpp b/sources/qtextorientationwidget.cpp index c5f7ba1cb..a1243f6fe 100644 --- a/sources/qtextorientationwidget.cpp +++ b/sources/qtextorientationwidget.cpp @@ -82,7 +82,7 @@ void QTextOrientationWidget::setFont(const QFont &font) { text_font_ = font; // invalide le cache contenant les longueurs des textes a disposition - for (QString text: text_size_hash_.keys()) { + foreach(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 - for (QString text: text_size_hash_.keys()) { + foreach(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) - for (QString text: texts_list) { + foreach(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_); - for (QString text: text_size_hash_.keys()) { + foreach(QString text, text_size_hash_.keys()) { if (text_size_hash_[text] == -1) { text_size_hash_[text] = font_metrics.boundingRect(text).width(); } diff --git a/sources/recentfiles.cpp b/sources/recentfiles.cpp index aff8746b2..b52ca2b09 100644 --- a/sources/recentfiles.cpp +++ b/sources/recentfiles.cpp @@ -173,7 +173,7 @@ void RecentFiles::buildMenu() { } // remplit le menu - for (QString filepath: list_) { + foreach (QString filepath, list_) { // creee une nouvelle action pour le fichier QAction *action = new QAction(filepath, this); if (!files_icon_.isNull()) { diff --git a/sources/richtext/richtexteditor.cpp b/sources/richtext/richtexteditor.cpp index d285d5132..ba779a400 100644 --- a/sources/richtext/richtexteditor.cpp +++ b/sources/richtext/richtexteditor.cpp @@ -440,7 +440,7 @@ RichTextEditorToolBar::RichTextEditorToolBar(RichTextEditor *editor, // Font size combo box m_font_size_input->setEditable(false); const QList font_sizes = QFontDatabase::standardSizes(); - for (int font_size: font_sizes) + foreach (int font_size, font_sizes) m_font_size_input->addItem(QString::number(font_size)); connect(m_font_size_input, SIGNAL(activated(QString)), diff --git a/sources/titleblock/helpercell.cpp b/sources/titleblock/helpercell.cpp index 2d9a37813..57985ccb9 100644 --- a/sources/titleblock/helpercell.cpp +++ b/sources/titleblock/helpercell.cpp @@ -137,7 +137,7 @@ void HelperCell::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { if (actions_.isEmpty()) return; QMenu context_menu; - for (QAction *action: actions_) { + foreach (QAction *action, actions_) { context_menu.addAction(action); } emit(contextMenuTriggered(this)); diff --git a/sources/titleblock/templatecellsset.cpp b/sources/titleblock/templatecellsset.cpp index 4abf491bd..4e0bcc43d 100644 --- a/sources/titleblock/templatecellsset.cpp +++ b/sources/titleblock/templatecellsset.cpp @@ -50,7 +50,7 @@ TitleBlockTemplateCellsSet::~TitleBlockTemplateCellsSet() { */ QPainterPath TitleBlockTemplateCellsSet::painterPath() const { QPainterPath cells_path; - for (TitleBlockTemplateVisualCell *cell: *this) { + foreach (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 { - for (TitleBlockTemplateVisualCell *cell: *this) { + foreach (TitleBlockTemplateVisualCell *cell, *this) { if (!cell -> isSelected()) { return(false); } @@ -91,7 +91,7 @@ bool TitleBlockTemplateCellsSet::hasExternalSpan() const { QSet all_cells = cells(true); // look for cells spanned by cells that do not belong to this set - for (TitleBlockCell *cell: all_cells) { + foreach (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 top_cells; - for (TitleBlockTemplateVisualCell *cell_view: *this) { + foreach (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; - for (TitleBlockTemplateVisualCell *cell_view: candidates) { + foreach (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 bottom_cells; - for (TitleBlockTemplateVisualCell *cell_view: *this) { + foreach (TitleBlockTemplateVisualCell *cell_view, *this) { bottom_cells.insertMulti(cell_view -> geometry().bottom(), cell_view); } QList 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; - for (TitleBlockTemplateVisualCell *cell_view: candidates) { + foreach (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 TitleBlockTemplateCellsSet::cells(bool include_spanned) const { QSet set; - for (TitleBlockTemplateVisualCell *cell_view: *this) { + foreach (TitleBlockTemplateVisualCell *cell_view, *this) { if (TitleBlockCell *cell = cell_view -> cell()) { if (include_spanned) { - for (TitleBlockCell *cell: cell_view -> cells()) { + foreach (TitleBlockCell *cell, cell_view -> cells()) { set << cell; } } else { diff --git a/sources/titleblock/templatecellwidget.cpp b/sources/titleblock/templatecellwidget.cpp index 4306fb1fd..f2188b616 100644 --- a/sources/titleblock/templatecellwidget.cpp +++ b/sources/titleblock/templatecellwidget.cpp @@ -308,7 +308,7 @@ void TitleBlockTemplateCellWidget::updateLogosComboBox(const TitleBlockTemplate logo_input_ -> setCurrentIndex(0); if (!parent_template) return; - for (QString logo: parent_template -> logos()) { + foreach (QString logo, parent_template -> logos()) { logo_input_ -> addItem(logo, QVariant(logo)); } int current_value_index = logo_input_ -> findData(current_value); diff --git a/sources/titleblock/templatecommands.cpp b/sources/titleblock/templatecommands.cpp index 469669e2c..19f96c59c 100644 --- a/sources/titleblock/templatecommands.cpp +++ b/sources/titleblock/templatecommands.cpp @@ -72,7 +72,7 @@ bool ModifyTitleBlockCellCommand::mergeWith(const QUndoCommand *command) { */ void ModifyTitleBlockCellCommand::undo() { if (!modified_cell_) return; - for (QString attribute: old_values_.keys()) { + foreach (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; - for (QString attribute: new_values_.keys()) { + foreach (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 - for (TitleBlockCell *cell: merged_cells.cells()) { + foreach(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 - for (TitleBlockCell *cell: spanner_cells_before_merge_.keys()) { + foreach (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 - for (TitleBlockCell *cell: spanner_cells_before_merge_.keys()) { + foreach (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; - for (TitleBlockCell *cell: logical_cells) { + foreach(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 - for (TitleBlockCell *cell: spanned_cells_) { + foreach(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 - for (TitleBlockCell *cell: spanned_cells_) { + foreach(TitleBlockCell *cell, spanned_cells_) { cell -> spanner_cell = 0; } @@ -898,7 +898,7 @@ CutTemplateCellsCommand::~CutTemplateCellsCommand() { Undo a cut operation */ void CutTemplateCellsCommand::undo() { - for (TitleBlockCell *cell: cut_cells_.keys()) { + foreach (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() { - for (TitleBlockCell *cell: cut_cells_.keys()) { + foreach (TitleBlockCell *cell, cut_cells_.keys()) { cell -> cell_type = TitleBlockCell::EmptyCell; } refreshView(); } void CutTemplateCellsCommand::setCutCells(const QList &cells) { - for (TitleBlockCell *cell: cells) { + foreach (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; - for (TitleBlockCell *cell: erased_cells_.keys()) { + foreach (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 - for (TitleBlockCell *cell: erased_cells_.keys()) { + foreach (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... - for (TitleBlockCell *spanned_cell: tbtemplate_ -> spannedCells(cell, true)) { + foreach (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 diff --git a/sources/titleblock/templatelocationchooser.cpp b/sources/titleblock/templatelocationchooser.cpp index fe174d40f..13db450a2 100644 --- a/sources/titleblock/templatelocationchooser.cpp +++ b/sources/titleblock/templatelocationchooser.cpp @@ -116,7 +116,7 @@ void TitleBlockTemplateLocationChooser::updateCollections() { collections_index_.clear(); int index = 0; - for (TitleBlockTemplatesCollection *collection: QETApp::availableTitleBlockTemplatesCollections()) { + foreach(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()) { - for (QString template_name: available_templates) { + foreach (QString template_name, available_templates) { templates_ -> addItem(template_name, QVariant(true)); } } diff --git a/sources/titleblock/templatelogomanager.cpp b/sources/titleblock/templatelogomanager.cpp index 7c0485df5..84271325c 100644 --- a/sources/titleblock/templatelogomanager.cpp +++ b/sources/titleblock/templatelogomanager.cpp @@ -137,7 +137,7 @@ void TitleBlockTemplateLogoManager::fillView() { if (!managed_template_) return; logos_view_ -> clear(); - for (QString logo_name: managed_template_ -> logos()) { + foreach (QString logo_name, managed_template_ -> logos()) { QIcon current_icon; QPixmap current_logo = managed_template_ -> bitmapLogo(logo_name); if (!current_logo.isNull()) { diff --git a/sources/titleblock/templatescollection.cpp b/sources/titleblock/templatescollection.cpp index 5e8f1eb59..630ebf9e3 100644 --- a/sources/titleblock/templatescollection.cpp +++ b/sources/titleblock/templatescollection.cpp @@ -98,7 +98,7 @@ QETProject *TitleBlockTemplatesCollection::parentProject() { */ QList TitleBlockTemplatesCollection::templatesLocations() { QList locations; - for (QString template_name: templates()) { + foreach (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) { - for (QDomElement e: QET::findInDomElement(xml_element, "titleblocktemplates", "titleblocktemplate")) { + foreach (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; - for (QString template_name: templates()) { + foreach (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)); - for (QString name: dir_.entryList()) { + foreach(QString name, dir_.entryList()) { templates_names << name.replace(replace_regexp, ""); } return(templates_names); diff --git a/sources/titleblock/templateview.cpp b/sources/titleblock/templateview.cpp index 3ddcee26e..42b2e544d 100644 --- a/sources/titleblock/templateview.cpp +++ b/sources/titleblock/templateview.cpp @@ -158,7 +158,7 @@ QList TitleBlockTemplateView::copy() { QDomDocument xml_export; QDomElement tbtpartial = xml_export.createElement("titleblocktemplate-partial"); xml_export.appendChild(tbtpartial); - for (TitleBlockCell *cell: copied_cells) { + foreach (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_); - for (TitleBlockCell cell: pasted_cells) { + foreach (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 &items) const { TitleBlockTemplateCellsSet set(this); - for (QGraphicsItem *item: items) { + foreach (QGraphicsItem *item, items) { if (TitleBlockTemplateVisualCell *cell_view = dynamic_cast(item)) { if (cell_view -> cell() && cell_view -> cell() -> num_row != -1) { set << cell_view; diff --git a/sources/titleblockproperties.cpp b/sources/titleblockproperties.cpp index c414b941e..189062684 100644 --- a/sources/titleblockproperties.cpp +++ b/sources/titleblockproperties.cpp @@ -125,7 +125,7 @@ void TitleBlockProperties::fromXml(const QDomElement &e) { // reads the additional fields used to fill the title block context.clear(); - for (QDomElement e: QET::findInDomElement(e, "properties")) { + foreach (QDomElement e, QET::findInDomElement(e, "properties")) { context.fromXml(e); } } diff --git a/sources/titleblocktemplate.cpp b/sources/titleblocktemplate.cpp index 9cbb9b3f5..6ebff8523 100644 --- a/sources/titleblocktemplate.cpp +++ b/sources/titleblocktemplate.cpp @@ -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 - for (QString logo_key: bitmap_logos_.keys()) { + foreach (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) - for (QString logo_key: vector_logos_.keys()) { + foreach (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); - for (QString rows_description: rows_descriptions) { + foreach (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); - for (QString cols_description: cols_descriptions) { + foreach (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 - for (TitleBlockColDimension icd, columns_width_) { + foreach (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"); - for (QString logo_name: type_logos_.keys()) { + foreach(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; - for (int row_height: rows_heights_) rows_attr += QString("%1;").arg(row_height); - for (TitleBlockDimension col_width: columns_width_) cols_attr += col_width.toShortString(); + foreach(int row_height, rows_heights_) rows_attr += QString("%1;").arg(row_height); + foreach(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 TitleBlockTemplate::columnsWidth(int total_width) const { int share = difference > 0 ? 1 : -1; if (qAbs(difference) <= max_acceptable_difference) { while (difference) { - for (int index: relative_columns) { + foreach (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; - for (int col_width: columnsWidth(total_width)) { + foreach (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; - for (int row_height: rows_heights_) { + foreach(int row_height, rows_heights_) { height += row_height; } return(height); @@ -1011,7 +1011,7 @@ QHash > TitleBlockTemplate::getAllSpans() cons Restore a set of span parameters. */ void TitleBlockTemplate::setAllSpans(const QHash > &spans) { - for (TitleBlockCell *cell: spans.keys()) { + foreach (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; - for (QString key: diagram_context.keys(DiagramContext::DecreasingLength)) { + foreach (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; - for (TitleBlockCell *spanned_cell: spannedCells(spanning_cell)) { + foreach (TitleBlockCell *spanned_cell, spannedCells(spanning_cell)) { spanned_cell -> spanner_cell = 0; } if (modify_cell) { diff --git a/sources/ui/conductorpropertiesdialog.cpp b/sources/ui/conductorpropertiesdialog.cpp index c5831b46a..3aec0bae0 100644 --- a/sources/ui/conductorpropertiesdialog.cpp +++ b/sources/ui/conductorpropertiesdialog.cpp @@ -74,7 +74,7 @@ void ConductorPropertiesDialog::PropertiesDialog(Conductor *conductor, QWidget * { undo->setText(tr("Modifier les propriétés de plusieurs conducteurs", "undo caption")); - for (Conductor *potential_conductor: conductor->relatedPotentialConductors()) + foreach (Conductor *potential_conductor, conductor->relatedPotentialConductors()) { old_value.setValue(potential_conductor->properties()); new QPropertyUndoCommand (potential_conductor, "properties", old_value, new_value, undo); diff --git a/sources/ui/diagrampropertieseditordockwidget.cpp b/sources/ui/diagrampropertieseditordockwidget.cpp index 3381a8d58..1880088de 100644 --- a/sources/ui/diagrampropertieseditordockwidget.cpp +++ b/sources/ui/diagrampropertieseditordockwidget.cpp @@ -125,7 +125,7 @@ void DiagramPropertiesEditorDockWidget::selectionChanged() clear(); } - for (PropertiesEditorWidget *pew: editors()) + foreach (PropertiesEditorWidget *pew, editors()) pew->setLiveEdit(true); } diff --git a/sources/ui/elementinfowidget.cpp b/sources/ui/elementinfowidget.cpp index e694fb43c..e261004c4 100644 --- a/sources/ui/elementinfowidget.cpp +++ b/sources/ui/elementinfowidget.cpp @@ -157,7 +157,7 @@ bool ElementInfoWidget::event(QEvent *event) */ void ElementInfoWidget::enableLiveEdit() { - for (ElementInfoPartWidget *eipw: m_eipw_list) + foreach (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() { - for (ElementInfoPartWidget *eipw: m_eipw_list) + foreach (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() { - for (QString str: QETApp::elementInfoKeys()) + foreach (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 { - for (ElementInfoPartWidget *eipw: m_eipw_list) + foreach (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(); - for (ElementInfoPartWidget *eipw: m_eipw_list) + foreach (ElementInfoPartWidget *eipw, m_eipw_list) { eipw -> setText (element_info[eipw->key()].toString()); @@ -246,7 +246,7 @@ DiagramContext ElementInfoWidget::currentInfo() const { DiagramContext info_; - for (ElementInfoPartWidget *eipw: m_eipw_list) + foreach (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()); diff --git a/sources/ui/elementpropertieswidget.cpp b/sources/ui/elementpropertieswidget.cpp index c920a125d..5927f68c5 100644 --- a/sources/ui/elementpropertieswidget.cpp +++ b/sources/ui/elementpropertieswidget.cpp @@ -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()) { - for (AbstractElementPropertiesEditorWidget *aepew: m_list_editor) + foreach (AbstractElementPropertiesEditorWidget *aepew, m_list_editor) { aepew->setElement(m_element); addGeneralWidget(); @@ -81,21 +81,21 @@ void ElementPropertiesWidget::apply() { QList undo_list; - for (PropertiesEditorWidget *pew: m_list_editor) + foreach (PropertiesEditorWidget *pew, m_list_editor) if (QUndoCommand *undo = pew->associatedUndo()) undo_list << undo; if (undo_list.isEmpty()) return; QString str; - for (QUndoCommand *uc: undo_list) str += uc->text() += " "; + foreach(QUndoCommand *uc, undo_list) str += uc->text() += " "; QUndoStack &stack = m_element -> diagram() -> undoStack(); stack.beginMacro(str); - for (QUndoCommand *uc: undo_list) stack.push(uc); + foreach(QUndoCommand *uc, undo_list) stack.push(uc); stack.endMacro(); - for (PropertiesEditorWidget *pew: m_list_editor) + foreach(PropertiesEditorWidget *pew, m_list_editor) pew->updateUi(); } @@ -104,7 +104,7 @@ void ElementPropertiesWidget::apply() * Reset the edited properties */ void ElementPropertiesWidget::reset() { - for (PropertiesEditorWidget *pew: m_list_editor) pew->reset(); + foreach (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; - for (AbstractElementPropertiesEditorWidget *aepew: m_list_editor) + foreach (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 - for (AbstractElementPropertiesEditorWidget *aepew: m_list_editor) + foreach (AbstractElementPropertiesEditorWidget *aepew, m_list_editor) { aepew->setLiveEdit(m_live_edit); m_tab->addTab(aepew, aepew->title()); diff --git a/sources/ui/linksingleelementwidget.cpp b/sources/ui/linksingleelementwidget.cpp index 67aa047b1..bb99e66cc 100644 --- a/sources/ui/linksingleelementwidget.cpp +++ b/sources/ui/linksingleelementwidget.cpp @@ -211,7 +211,7 @@ void LinkSingleElementWidget::buildTree() if (m_element->linkType() == Element::Slave) { - for (Element *elmt: availableElements()) + foreach(Element *elmt, availableElements()) { QStringList search_list; QStringList str_list; @@ -255,7 +255,7 @@ void LinkSingleElementWidget::buildTree() else if (m_element->linkType() & Element::AllReport) { - for (Element *elmt: availableElements()) + foreach(Element *elmt, availableElements()) { QStringList search_list; QStringList str_list; @@ -362,7 +362,7 @@ void LinkSingleElementWidget::setUpCompleter() delete ui->m_search_field->completer(); QStringList search; - for (QStringList strl: m_qtwi_strl_hash.values()) + foreach(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; } - for (QTreeWidgetItem *qtwi: m_qtwi_elmt_hash.keys()) + foreach(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 - for (QTreeWidgetItem *qtwi: m_qtwi_elmt_hash.keys()) + foreach(QTreeWidgetItem *qtwi, m_qtwi_elmt_hash.keys()) qtwi->setHidden(!arg1.isEmpty()); QList qtwi_list; - for (QTreeWidgetItem *qtwi: m_qtwi_strl_hash.keys()) + foreach(QTreeWidgetItem *qtwi, m_qtwi_strl_hash.keys()) { - for (QString str: m_qtwi_strl_hash.value(qtwi)) + foreach(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 - for (QTreeWidgetItem *qtwi: qtwi_list) + foreach(QTreeWidgetItem *qtwi, qtwi_list) qtwi->setHidden(false); } diff --git a/sources/ui/masterpropertieswidget.cpp b/sources/ui/masterpropertieswidget.cpp index b652e5323..eca3511da 100644 --- a/sources/ui/masterpropertieswidget.cpp +++ b/sources/ui/masterpropertieswidget.cpp @@ -150,7 +150,7 @@ void MasterPropertiesWidget::apply() { */ void MasterPropertiesWidget::reset() { - for (QTreeWidgetItem *qtwi: m_qtwi_hash.keys()) + foreach (QTreeWidgetItem *qtwi, m_qtwi_hash.keys()) delete qtwi; m_qtwi_hash.clear(); @@ -177,7 +177,7 @@ QUndoCommand* MasterPropertiesWidget::associatedUndo() const { bool equal = true; - for (Element *elmt: to_link) + foreach(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 items_list; - for (Element *elmt: elmt_prov.freeElement(Element::Slave)) + foreach(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 - for (Element *elmt: m_element->linkedElements()) + foreach(Element *elmt, m_element->linkedElements()) { QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_link_tree_widget); qtwi->setIcon(0, elmt->pixmap()); diff --git a/sources/ui/potentialselectordialog.cpp b/sources/ui/potentialselectordialog.cpp index 81bae303b..4039aa0bb 100644 --- a/sources/ui/potentialselectordialog.cpp +++ b/sources/ui/potentialselectordialog.cpp @@ -82,7 +82,7 @@ class NewConductorPotentialSelector : public AbstractPotentialSelector if ((elmt_->linkType() & Element::Terminale) && !elmt_->terminals().isEmpty()) { - for (Terminal *t: elmt_->terminals()) + foreach(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); - for (Conductor *c: c_list) + foreach(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()); - for (Conductor *c: m_conductors_list_1) + foreach(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()); - for (Conductor *c: m_conductors_list_2) + foreach(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 - for (Conductor *cond: m_conductors_to_change) + foreach(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"); - for (ConductorProperties cp: m_properties_list) + foreach(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 c_list = m_report->conductors().first()->relatedPotentialConductors(); c_list.insert(m_report->conductors().first()); - for (Conductor *cond: c_list) + foreach(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 - for (Conductor *cond: m_conductor->relatedPotentialConductors()) + foreach(Conductor *cond, m_conductor->relatedPotentialConductors()) { new_properties = cond->properties(); new_properties.applyForEqualAttributes(m_properties_list); diff --git a/sources/ui/titleblockpropertieswidget.cpp b/sources/ui/titleblockpropertieswidget.cpp index e1b1afe53..479b1b27a 100644 --- a/sources/ui/titleblockpropertieswidget.cpp +++ b/sources/ui/titleblockpropertieswidget.cpp @@ -72,7 +72,7 @@ TitleBlockPropertiesWidget::TitleBlockPropertiesWidget(QListsetupUi(this); initDialog(current_date,project); - for (TitleBlockTemplatesCollection *c: tbt_collection) + foreach (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; - for (TitleBlockTemplatesCollection *c: m_tbt_collection_list) + foreach (TitleBlockTemplatesCollection *c, m_tbt_collection_list) if (c -> collection() == qc) collection = c; @@ -307,7 +307,7 @@ void TitleBlockPropertiesWidget::initDialog(const bool ¤t_date, QETProjec if (project!= NULL){ keys_2 = project -> folioAutoNum().keys(); - for (QString str: keys_2) { ui -> auto_page_cb -> addItem(str); } + foreach (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 - for (TitleBlockTemplatesCollection *tbt_c: m_tbt_collection_list) + foreach (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; - for (QString tbt_name: tbt_c -> templates()) + foreach(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; - for (TitleBlockTemplatesCollection *c: m_tbt_collection_list) + foreach (TitleBlockTemplatesCollection *c, m_tbt_collection_list) if (c -> collection() == qc) collection = c; diff --git a/sources/undocommand/linkelementcommand.cpp b/sources/undocommand/linkelementcommand.cpp index fd0e68ffb..1e472c2fc 100644 --- a/sources/undocommand/linkelementcommand.cpp +++ b/sources/undocommand/linkelementcommand.cpp @@ -177,7 +177,7 @@ void LinkElementCommand::setLink(Element *element_) */ void LinkElementCommand::unlink(QList element_list) { - for (Element *elmt: element_list) + foreach(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; - for (const Conductor *c: c_list) strl<<(c->properties().text); + foreach (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_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) { - for (Element *elmt: element_list) + foreach(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_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"; - for (Element *elmt: element_list) + foreach(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_list) } //We link all element from element_list - for (Element *elmt: element_list) + foreach(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 to_unlink = m_element->linkedElements(); - for (Element *elmt: element_list) + foreach(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()) - for (Element *elmt: to_unlink) + foreach(Element *elmt, to_unlink) m_element->unlinkElement(elmt); }