From 43f0107eb1ff5bc9108530b80dcfccd1350978ab Mon Sep 17 00:00:00 2001 From: Laurent Trinques Date: Fri, 14 Feb 2025 16:17:58 +0100 Subject: [PATCH] Revert "Try Clazy fix-its" Segfault on old Qt versions! This reverts commit dba7caed3035585af4b301ed87bd4131dcac994c. --- .../elementscollectionwidget.cpp | 5 +- .../ElementsCollection/elementstreeview.cpp | 4 +- .../xmlprojectelementcollectionitem.cpp | 3 +- sources/NameList/ui/namelistwidget.cpp | 5 +- sources/QWidgetAnimation/qwidgetanimation.cpp | 3 +- .../searchandreplaceworker.cpp | 26 +++---- .../ui/replaceadvanceddialog.cpp | 9 +-- .../ui/replaceelementdialog.cpp | 9 +-- .../ui/searchandreplacewidget.cpp | 31 ++++---- .../GraphicsItem/terminalstripdrawer.cpp | 3 +- .../UndoCommand/addterminalstripcommand.cpp | 6 +- .../UndoCommand/addterminaltostripcommand.cpp | 3 +- sources/TerminalStrip/physicalterminal.cpp | 9 +-- .../TerminalStrip/ui/freeterminalmodel.cpp | 3 +- .../TerminalStrip/ui/terminalstripeditor.cpp | 2 +- .../TerminalStrip/ui/terminalstripmodel.cpp | 2 +- sources/conductornumexport.cpp | 2 +- sources/conductorproperties.cpp | 42 +++++----- sources/dataBase/projectdatabase.cpp | 11 +-- sources/dataBase/ui/elementquerywidget.cpp | 17 ++-- sources/dataBase/ui/summaryquerywidget.cpp | 9 +-- sources/diagram.cpp | 77 +++++++++---------- sources/diagramcontent.cpp | 4 +- sources/diagramcontext.cpp | 7 +- .../editor/UndoCommand/pastepartscommand.cpp | 6 +- sources/editor/arceditor.cpp | 5 +- sources/editor/editorcommands.cpp | 4 +- sources/editor/elementprimitivedecorator.cpp | 18 ++--- sources/editor/elementscene.cpp | 2 +- .../graphicspart/customelementgraphicpart.cpp | 2 +- sources/editor/graphicspart/partarc.cpp | 8 +- sources/editor/graphicspart/partellipse.cpp | 6 +- sources/editor/graphicspart/partline.cpp | 2 +- sources/editor/graphicspart/partpolygon.cpp | 10 +-- sources/editor/graphicspart/partrectangle.cpp | 10 +-- sources/editor/styleeditor.cpp | 2 +- sources/editor/ui/dynamictextfieldeditor.cpp | 7 +- sources/editor/ui/ellipseeditor.cpp | 3 +- sources/editor/ui/lineeditor.cpp | 3 +- sources/editor/ui/polygoneditor.cpp | 3 +- sources/editor/ui/qetelementeditor.cpp | 16 ++-- sources/editor/ui/rectangleeditor.cpp | 3 +- sources/editor/ui/texteditor.cpp | 5 +- sources/elementprovider.cpp | 3 +- sources/elementspanel.cpp | 4 +- sources/elementtextpattern.cpp | 8 +- sources/exportdialog.cpp | 15 ++-- sources/factory/elementpicturefactory.cpp | 5 +- sources/genericpanel.cpp | 18 +++-- sources/print/projectprintwindow.cpp | 5 +- sources/properties/xrefproperties.cpp | 3 +- sources/qetapp.cpp | 4 +- sources/qetdiagrameditor.cpp | 18 ++--- .../ViewItem/qetgraphicsheaderitem.cpp | 4 +- .../ui/graphicstablepropertieseditor.cpp | 17 ++-- sources/qetgraphicsitem/conductor.cpp | 13 ++-- sources/qetgraphicsitem/crossrefitem.cpp | 8 +- .../dynamicelementtextitem.cpp | 3 +- sources/qetgraphicsitem/element.cpp | 16 ++-- .../qetgraphicsitem/elementtextitemgroup.cpp | 14 ++-- sources/qetgraphicsitem/qetshapeitem.cpp | 31 +++----- sources/qetgraphicsitem/terminal.cpp | 2 +- sources/qetinformation.cpp | 3 +- sources/qetxml.cpp | 2 +- sources/qtextorientationwidget.cpp | 10 +-- sources/titleblock/helpercell.cpp | 6 +- .../integrationmovetemplateshandler.cpp | 9 +-- sources/titleblock/qettemplateeditor.cpp | 21 ++--- sources/titleblock/templatescollection.cpp | 2 +- sources/titleblock/templateview.cpp | 7 +- sources/titleblocktemplate.cpp | 8 +- sources/ui/aboutqetdialog.cpp | 4 +- sources/ui/diagramcontextwidget.cpp | 2 +- sources/ui/dynamicelementtextitemeditor.cpp | 33 ++++---- sources/ui/dynamicelementtextmodel.cpp | 4 +- sources/ui/elementinfowidget.cpp | 22 +++--- sources/ui/elementpropertieswidget.cpp | 9 +-- sources/ui/inditextpropertieswidget.cpp | 40 ++++------ sources/ui/multipastedialog.cpp | 2 +- sources/ui/potentialselectordialog.cpp | 2 +- .../ui/shapegraphicsitempropertieswidget.cpp | 34 ++++---- sources/undocommand/addelementtextcommand.cpp | 12 ++- .../changeelementinformationcommand.cpp | 19 +++-- .../deleteqgraphicsitemcommand.cpp | 28 +++---- sources/undocommand/linkelementcommand.cpp | 2 +- .../undocommand/rotateselectioncommand.cpp | 18 ++--- sources/undocommand/rotatetextscommand.cpp | 6 +- sources/utils/conductorcreator.cpp | 18 ++--- 88 files changed, 409 insertions(+), 512 deletions(-) diff --git a/sources/ElementsCollection/elementscollectionwidget.cpp b/sources/ElementsCollection/elementscollectionwidget.cpp index 24e71f8f5..2ab4e9ab3 100644 --- a/sources/ElementsCollection/elementscollectionwidget.cpp +++ b/sources/ElementsCollection/elementscollectionwidget.cpp @@ -779,8 +779,7 @@ void ElementsCollectionWidget::search() const QStringList text_list = text.split("+", Qt::SkipEmptyParts); #endif QModelIndexList match_index; - for (const QString& txt : text_list) - { + for (QString txt : text_list) { match_index << m_model->match(m_showed_index.isValid() ? m_model->index(0,0,m_showed_index) : m_model->index(0,0), @@ -791,7 +790,7 @@ void ElementsCollectionWidget::search() | Qt::MatchRecursive); } - for (QModelIndex index : std::as_const(match_index)) + for(QModelIndex index : match_index) showAndExpandItem(index); } diff --git a/sources/ElementsCollection/elementstreeview.cpp b/sources/ElementsCollection/elementstreeview.cpp index be59d0760..e84b6a3ce 100644 --- a/sources/ElementsCollection/elementstreeview.cpp +++ b/sources/ElementsCollection/elementstreeview.cpp @@ -41,8 +41,8 @@ ElementsTreeView::ElementsTreeView(QWidget *parent) : QPalette qp = palette(); qp.setColor(QPalette::Text, Qt::black); qp.setColor(QPalette::Base, Qt::white); - qp.setColor(QPalette::AlternateBase, QColor(0xe8e8e8)); - qp.setColor(QPalette::Highlight, QColor(0x678db2)); + qp.setColor(QPalette::AlternateBase, QColor("#e8e8e8")); + qp.setColor(QPalette::Highlight, QColor("#678db2")); qp.setColor(QPalette::HighlightedText, Qt::black); setPalette(qp); } diff --git a/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp b/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp index fa61ec7cf..7015b9ec3 100644 --- a/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp +++ b/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp @@ -206,8 +206,7 @@ void XmlProjectElementCollectionItem::setUpData() ElementsLocation location(embeddedPath(), m_project); DiagramContext context = location.elementInformations(); QStringList search_list; - for (const QString& key : context.keys()) - { + for (QString key : context.keys()) { search_list.append(context.value(key).toString()); } search_list.append(localName()); diff --git a/sources/NameList/ui/namelistwidget.cpp b/sources/NameList/ui/namelistwidget.cpp index 7f3cb9a12..0024f5a3d 100644 --- a/sources/NameList/ui/namelistwidget.cpp +++ b/sources/NameList/ui/namelistwidget.cpp @@ -59,7 +59,7 @@ void NameListWidget::addLine() */ void NameListWidget::setNames(const NamesList &name_list) { - for (const QString& lang : name_list.langs()) + for (QString lang : name_list.langs()) { QString value = name_list[lang]; QStringList values; @@ -138,8 +138,7 @@ void NameListWidget::setClipboardValue(QHash value) QStringList list = value.keys(); list.sort(); - for (const QString& key : list) - { + for (QString key : list) { ui->m_clipboard_cb->addItem(key, value.value(key)); } } diff --git a/sources/QWidgetAnimation/qwidgetanimation.cpp b/sources/QWidgetAnimation/qwidgetanimation.cpp index f07a683eb..b76114522 100644 --- a/sources/QWidgetAnimation/qwidgetanimation.cpp +++ b/sources/QWidgetAnimation/qwidgetanimation.cpp @@ -98,8 +98,7 @@ void QWidgetAnimation::show() int available_ = m_orientation == Qt::Horizontal ? m_widget->parentWidget()->width() : m_widget->parentWidget()->height(); - for (auto w : std::as_const(m_widget_to_substract)) - { + for (auto w : m_widget_to_substract) { available_ -= m_orientation == Qt::Horizontal ? w->minimumSizeHint().width() : w->minimumSizeHint().height(); diff --git a/sources/SearchAndReplace/searchandreplaceworker.cpp b/sources/SearchAndReplace/searchandreplaceworker.cpp index 6874f0e98..6bd0722c3 100644 --- a/sources/SearchAndReplace/searchandreplaceworker.cpp +++ b/sources/SearchAndReplace/searchandreplaceworker.cpp @@ -128,7 +128,7 @@ void SearchAndReplaceWorker::replaceElement(QList list) { DiagramContext old_context; DiagramContext new_context = old_context = elmt->elementInformations(); - for (const QString& key : QETInformation::elementInfoKeys()) + for (QString key : QETInformation::elementInfoKeys()) { new_context.addValue(key, applyChange(old_context.value(key).toString(), m_element_context.value(key).toString())); @@ -219,7 +219,7 @@ void SearchAndReplaceWorker::replaceConductor(QList list) { QSet conductors_list = c->relatedPotentialConductors(true); conductors_list << c; - for (Conductor* cc : std::as_const(conductors_list)) + for (Conductor *cc : conductors_list) { QVariant old_value, new_value; old_value.setValue(cc->properties()); @@ -270,26 +270,22 @@ void SearchAndReplaceWorker::replaceAdvanced( return; } - for (Diagram* dd : std::as_const(diagrams)) - { + for (Diagram *dd : diagrams) { if (dd->project() != project_) { return; } } - for (Element* elmt : std::as_const(elements)) - { + for (Element *elmt : elements) { if (!elmt->diagram() || elmt->diagram()->project() != project_) { return; } } - for (IndependentTextItem* text : std::as_const(texts)) - { + for (IndependentTextItem *text : texts) { if (!text->diagram() || text->diagram()->project() != project_) { return; } } - for (Conductor* cc : std::as_const(conductors)) - { + for (Conductor *cc : conductors) { if (!cc->diagram() || cc->diagram()->project() != project_) { return; } @@ -304,7 +300,7 @@ void SearchAndReplaceWorker::replaceAdvanced( project_->undoStack()->beginMacro(QObject::tr("Rechercher / remplacer avancé")); if (who == 0) { - for (Diagram* diagram : std::as_const(diagrams)) + for (Diagram *diagram : diagrams) { TitleBlockProperties old_properties = diagram->border_and_titleblock.exportTitleBlock(); TitleBlockProperties new_properties = replaceAdvanced(diagram); @@ -315,7 +311,7 @@ void SearchAndReplaceWorker::replaceAdvanced( } else if (who == 1) { - for (Element* element : std::as_const(elements)) + for (Element *element : elements) { DiagramContext old_context = element->elementInformations(); DiagramContext new_context = replaceAdvanced(element); @@ -326,7 +322,7 @@ void SearchAndReplaceWorker::replaceAdvanced( } else if (who == 2) { - for (Conductor* conductor : std::as_const(conductors)) + for (Conductor *conductor : conductors) { ConductorProperties old_properties = conductor->properties(); ConductorProperties new_properties = replaceAdvanced(conductor); @@ -335,7 +331,7 @@ void SearchAndReplaceWorker::replaceAdvanced( QSet potential_conductors = conductor->relatedPotentialConductors(true); potential_conductors << conductor; - for (Conductor* c : std::as_const(potential_conductors)) + for (Conductor *c : potential_conductors) { QVariant old_value, new_value; old_value.setValue(c->properties()); @@ -347,7 +343,7 @@ void SearchAndReplaceWorker::replaceAdvanced( } else if (who == 3) { - for (IndependentTextItem* text : std::as_const(texts)) + for (IndependentTextItem *text : texts) { QRegularExpression rx(m_advanced_struct.search); if (!rx.isValid()) diff --git a/sources/SearchAndReplace/ui/replaceadvanceddialog.cpp b/sources/SearchAndReplace/ui/replaceadvanceddialog.cpp index ddcfc547d..6a7035375 100644 --- a/sources/SearchAndReplace/ui/replaceadvanceddialog.cpp +++ b/sources/SearchAndReplace/ui/replaceadvanceddialog.cpp @@ -95,20 +95,17 @@ void replaceAdvancedDialog::fillWhatComboBox(int index) if (index == 0) { - for (const QString& str : QETInformation::diagramInfoKeys()) - { + for (QString str : QETInformation::diagramInfoKeys()) { ui->m_what_cb->addItem(QETInformation::translatedInfoKey(str), str); } } else if (index == 1) { - for (const QString& str : QETInformation::elementInfoKeys()) - { + for (QString str : QETInformation::elementInfoKeys()) { ui->m_what_cb->addItem(QETInformation::translatedInfoKey(str), str); } } else if (index == 2) { - for (const auto& str : QETInformation::conductorInfoKeys()) - { + for (auto str : QETInformation::conductorInfoKeys()) { ui->m_what_cb->addItem(QETInformation::translatedInfoKey(str), str); } } diff --git a/sources/SearchAndReplace/ui/replaceelementdialog.cpp b/sources/SearchAndReplace/ui/replaceelementdialog.cpp index dc28e2cd7..eb030c1be 100644 --- a/sources/SearchAndReplace/ui/replaceelementdialog.cpp +++ b/sources/SearchAndReplace/ui/replaceelementdialog.cpp @@ -48,9 +48,8 @@ ReplaceElementDialog::~ReplaceElementDialog() void ReplaceElementDialog::setContext(DiagramContext context) { m_context = context; - - for (ElementInfoPartWidget* eipw : std::as_const(m_eipw_list)) - { + + for (ElementInfoPartWidget *eipw : m_eipw_list) { eipw->setText(m_context[eipw->key()].toString()); } } @@ -74,8 +73,8 @@ void ReplaceElementDialog::buildWidget() connect(ui->m_button_box, &QDialogButtonBox::clicked, [this](QAbstractButton *button_) { this->done(ui->m_button_box->buttonRole(button_)); }); - - for (const QString& str : QETInformation::elementInfoKeys()) + + for (QString str : QETInformation::elementInfoKeys()) { ElementInfoPartWidget *eipw = new ElementInfoPartWidget(str, QETInformation::translatedInfoKey(str), this); eipw->setEraseTextVisible(true); diff --git a/sources/SearchAndReplace/ui/searchandreplacewidget.cpp b/sources/SearchAndReplace/ui/searchandreplacewidget.cpp index cc1bf40ab..75ae79c1b 100644 --- a/sources/SearchAndReplace/ui/searchandreplacewidget.cpp +++ b/sources/SearchAndReplace/ui/searchandreplacewidget.cpp @@ -127,7 +127,7 @@ void SearchAndReplaceWidget::clear() qDeleteAll(m_conductor_hash.keys()); m_conductor_hash.clear(); - for (QTreeWidgetItem* qtwi : std::as_const(m_category_qtwi)) + for (QTreeWidgetItem *qtwi : m_category_qtwi) qtwi->setHidden(false); ui->m_tree_widget->collapseAll(); @@ -284,17 +284,18 @@ void SearchAndReplaceWidget::fillItemsList() dc += DiagramContent(diagram, false); } - for (Element* elmt : std::as_const(dc.m_elements)) addElement(elmt); + for (Element *elmt : dc.m_elements) + addElement(elmt); //Sort child of each "element type" tree item. //we hide, "element type" tree item, if they do not have children - for (QTreeWidgetItem* qtwi : std::as_const(m_qtwi_elmts)) + for(QTreeWidgetItem *qtwi : m_qtwi_elmts) { qtwi->sortChildren(0, Qt::AscendingOrder); qtwi->setHidden(qtwi->childCount() ? false : true); } - for (IndependentTextItem* iti : std::as_const(dc.m_text_fields)) + for (IndependentTextItem *iti : dc.m_text_fields) { QTreeWidgetItem *qtwi = new QTreeWidgetItem(m_indi_text_qtwi); qtwi->setText(0, iti->toPlainText()); @@ -305,7 +306,7 @@ void SearchAndReplaceWidget::fillItemsList() m_indi_text_qtwi->sortChildren(0, Qt::AscendingOrder); - for (Conductor* c : std::as_const(dc.m_potential_conductors)) + for (Conductor *c : dc.m_potential_conductors) { QTreeWidgetItem *qtwi = new QTreeWidgetItem(m_conductor_qtwi); qtwi->setText(0, c->properties().text); @@ -378,8 +379,7 @@ void SearchAndReplaceWidget::search() (*it)->setHidden(false); } - for (QTreeWidgetItem* item : std::as_const(m_category_qtwi)) - { + for (QTreeWidgetItem *item : m_category_qtwi) { item->setExpanded(false); } m_root_qtwi->setExpanded(true); @@ -442,9 +442,9 @@ void SearchAndReplaceWidget::search() } QPalette background = ui->m_search_le->palette(); - background.setColor( - QPalette::Base, - match ? QColor(0xE0FFF0) : QColor(0xFFE0EF)); + background.setColor(QPalette::Base, match + ? QColor("#E0FFF0") + : QColor("#FFE0EF")); ui->m_search_le->setPalette(background); //Go to the first occurrence @@ -488,8 +488,7 @@ void SearchAndReplaceWidget::setUpConenctions() connect(m_select_elements, &QAction::triggered, [this]() { DiagramContent dc(m_diagram_hash.value(ui->m_tree_widget->currentItem()), false); - for (auto elmt : std::as_const(dc.m_elements)) - { + for (auto elmt : dc.m_elements) { if (auto item = m_element_hash.key(elmt)) { item->setCheckState(0, Qt::Checked); } @@ -509,8 +508,7 @@ void SearchAndReplaceWidget::setUpConenctions() connect(m_select_texts, &QAction::triggered, [this]() { DiagramContent dc(m_diagram_hash.value(ui->m_tree_widget->currentItem()), false); - for (auto text : std::as_const(dc.m_text_fields)) - { + for (auto text : dc.m_text_fields) { if (auto item = m_text_hash.key(text)) { item->setCheckState(0, Qt::Checked); } @@ -860,8 +858,7 @@ QStringList SearchAndReplaceWidget::searchTerms(Diagram *diagram) list.append(prop.indexrev); list.append(prop.folio); list.append(prop.date.toString()); - for (const QString& key : prop.context.keys()) - { + for (QString key : prop.context.keys()) { list.append(prop.context.value(key).toString()); } @@ -877,7 +874,7 @@ QStringList SearchAndReplaceWidget::searchTerms(Element *element) { QStringList list; DiagramContext context = element->elementInformations(); - for (const QString& key : QETInformation::elementInfoKeys()) + for (QString key : QETInformation::elementInfoKeys()) { QString str = context.value(key).toString(); if (!str.isEmpty()) { diff --git a/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp b/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp index 449778637..16c2b5146 100644 --- a/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp +++ b/sources/TerminalStrip/GraphicsItem/terminalstripdrawer.cpp @@ -241,8 +241,7 @@ int TerminalStripDrawer::height() const height_ = std::max(height_, m_pattern->m_spacer_rect.y() + m_pattern->m_spacer_rect.height()); - for (const auto& rect : std::as_const(m_pattern->m_terminal_rect)) - { + for (const auto &rect : m_pattern->m_terminal_rect) { height_ = std::max(height_, rect.y() + rect.height()); } diff --git a/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp b/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp index 135077948..9e1a30db1 100644 --- a/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp +++ b/sources/TerminalStrip/UndoCommand/addterminalstripcommand.cpp @@ -74,8 +74,7 @@ RemoveTerminalStripCommand::~RemoveTerminalStripCommand() void RemoveTerminalStripCommand::undo() { if (m_project && m_strip) { - for (const auto& elmt : std::as_const(m_elements)) - { + for (auto elmt : m_elements) { m_strip->addTerminal(elmt); } m_project->addTerminalStrip(m_strip); @@ -85,8 +84,7 @@ void RemoveTerminalStripCommand::undo() void RemoveTerminalStripCommand::redo() { if (m_project && m_strip) { - for (const auto& elmt : std::as_const(m_elements)) - { + for (auto elmt : m_elements) { m_strip->removeTerminal(elmt); } m_project->removeTerminalStrip(m_strip); diff --git a/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.cpp b/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.cpp index 305e8aa22..8ae0cc0e2 100644 --- a/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.cpp +++ b/sources/TerminalStrip/UndoCommand/addterminaltostripcommand.cpp @@ -161,8 +161,7 @@ MoveTerminalCommand::MoveTerminalCommand(QSharedPointer termin m_new_strip {new_strip} { QString t_label; - for (const auto& real_t : terminal->realTerminals()) - { + for (auto real_t : terminal->realTerminals()) { if (!t_label.isEmpty()) t_label.append(", "); t_label.append(real_t->label()); diff --git a/sources/TerminalStrip/physicalterminal.cpp b/sources/TerminalStrip/physicalterminal.cpp index 9fac582ed..f9c06de3e 100644 --- a/sources/TerminalStrip/physicalterminal.cpp +++ b/sources/TerminalStrip/physicalterminal.cpp @@ -31,8 +31,7 @@ PhysicalTerminal::PhysicalTerminal(TerminalStrip *parent_strip, m_parent_terminal_strip(parent_strip), m_real_terminal(terminals) { - for (const auto& real_t : std::as_const(m_real_terminal)) - { + for (const auto &real_t : m_real_terminal) { if (real_t) { real_t->setPhysicalTerminal(sharedRef()); } @@ -87,8 +86,7 @@ QDomElement PhysicalTerminal::toXml(QDomDocument &parent_document) const */ void PhysicalTerminal::setTerminals(const QVector> &terminals) { m_real_terminal = terminals; - for (const auto& real_t : std::as_const(m_real_terminal)) - { + for (const auto &real_t : m_real_terminal) { if (real_t) { real_t->setPhysicalTerminal(sharedRef()); } @@ -150,8 +148,7 @@ void PhysicalTerminal::setParentStrip(TerminalStrip *strip) PhysicalTerminal::~PhysicalTerminal() { - for (const auto& real_t : std::as_const(m_real_terminal)) - { + for (const auto &real_t : m_real_terminal) { if (real_t) { real_t->setPhysicalTerminal(QSharedPointer()); } diff --git a/sources/TerminalStrip/ui/freeterminalmodel.cpp b/sources/TerminalStrip/ui/freeterminalmodel.cpp index 147ca35a8..546851ea7 100644 --- a/sources/TerminalStrip/ui/freeterminalmodel.cpp +++ b/sources/TerminalStrip/ui/freeterminalmodel.cpp @@ -315,8 +315,7 @@ void FreeTerminalModel::fillTerminalVector() b->elementData().m_informations.value(QETInformation::ELMT_LABEL).toString()); }); - for (const auto& terminal_ : std::as_const(free_terminal_vector)) - { + for (const auto &terminal_ : free_terminal_vector) { m_terminal_vector.append(terminal_->realTerminal()); m_real_t_data.append(modelRealTerminalData::data(terminal_->realTerminal())); } diff --git a/sources/TerminalStrip/ui/terminalstripeditor.cpp b/sources/TerminalStrip/ui/terminalstripeditor.cpp index d4322b27d..d9ad4e0eb 100644 --- a/sources/TerminalStrip/ui/terminalstripeditor.cpp +++ b/sources/TerminalStrip/ui/terminalstripeditor.cpp @@ -456,7 +456,7 @@ void TerminalStripEditor::on_m_group_terminals_pb_clicked() QVector> vector_; int count_ = 0; - for (const auto& mrtd : std::as_const(mrtd_vector)) + for (const auto & mrtd : mrtd_vector) { const auto real_t = mrtd.real_terminal.toStrongRef(); vector_.append(real_t); diff --git a/sources/TerminalStrip/ui/terminalstripmodel.cpp b/sources/TerminalStrip/ui/terminalstripmodel.cpp index fc6bc2043..7cd2c4014 100644 --- a/sources/TerminalStrip/ui/terminalstripmodel.cpp +++ b/sources/TerminalStrip/ui/terminalstripmodel.cpp @@ -428,7 +428,7 @@ modelRealTerminalData TerminalStripModel::modelRealTerminalDataForIndex(const QM void TerminalStripModel::buildBridgePixmap(const QSize &pixmap_size) { m_bridges_pixmaps.clear(); - for (const auto& color_ : TerminalStripBridge::bridgeColor()) + for (auto color_ : TerminalStripBridge::bridgeColor()) { QPen pen; pen.setColor(color_); diff --git a/sources/conductornumexport.cpp b/sources/conductornumexport.cpp index deca66438..a18bf527b 100644 --- a/sources/conductornumexport.cpp +++ b/sources/conductornumexport.cpp @@ -102,7 +102,7 @@ QString ConductorNumExport::wiresNum() const QStringList list = m_hash.keys(); list.sort(); - for (const QString& key : list) + for (QString key : list) { for (int i=0; i lis //Color c_value = clist.first().color; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.color != c_value) equal = false; @@ -524,7 +524,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //bicolor b_value = clist.first().m_bicolor; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_bicolor != b_value) equal = false; @@ -535,7 +535,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //second color c_value = clist.first().m_color_2; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_color_2 != c_value) equal = false; @@ -546,7 +546,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //Dash size i_value = clist.first().m_dash_size; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_dash_size != i_value) equal = false; @@ -557,7 +557,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //text s_value = clist.first().text; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.text != s_value) equal = false; @@ -568,7 +568,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //text color c_value = clist.first().text_color; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.text_color != c_value) equal = false; @@ -579,7 +579,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //formula s_value = clist.first().m_formula; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_formula != s_value) equal = false; @@ -590,7 +590,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //cable s_value = clist.first().m_cable; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_cable != s_value) equal = false; @@ -601,7 +601,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //bus s_value = clist.first().m_bus; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_bus != s_value) equal = false; @@ -612,7 +612,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //function s_value = clist.first().m_function; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_function != s_value) equal = false; @@ -623,7 +623,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //Tension protocol s_value = clist.first().m_tension_protocol; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_tension_protocol != s_value) equal = false; @@ -634,7 +634,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //conductor_color s_value = clist.first().m_wire_color; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_wire_color != s_value) equal = false; @@ -645,7 +645,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //conductor_section s_value = clist.first().m_wire_section; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_wire_section != s_value) equal = false; @@ -657,7 +657,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //text size i_value = clist.first().text_size; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.text_size != i_value) equal = false; @@ -668,7 +668,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //conductor size d_value = clist.first().cond_size; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.cond_size != d_value) equal = false; @@ -679,7 +679,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //show text b_value = clist.first().m_show_text; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_show_text != b_value) equal = false; @@ -690,7 +690,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //One text per folio b_value = clist.first().m_one_text_per_folio; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_one_text_per_folio != b_value) equal = false; @@ -701,7 +701,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //Text rotation for vertical conducor d_value = clist.first().verti_rotate_text; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.verti_rotate_text != d_value) equal = false; @@ -712,7 +712,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //Text rotation for horizontal conducor d_value = clist.first().horiz_rotate_text; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.horiz_rotate_text != d_value) equal = false; @@ -723,7 +723,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //Text alignment for horizontal conducor align_value = clist.first().m_horizontal_alignment; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_horizontal_alignment != align_value) equal = false; @@ -734,7 +734,7 @@ void ConductorProperties::applyForEqualAttributes(QList lis //Text alignment for vertical conducor align_value = clist.first().m_vertical_alignment; - for (const ConductorProperties& cp : clist) + for(ConductorProperties cp : clist) { if (cp.m_vertical_alignment != align_value) equal = false; diff --git a/sources/dataBase/projectdatabase.cpp b/sources/dataBase/projectdatabase.cpp index d6eb313c8..f645a8d4d 100644 --- a/sources/dataBase/projectdatabase.cpp +++ b/sources/dataBase/projectdatabase.cpp @@ -160,8 +160,7 @@ void projectDataBase::removeElement(Element *element) void projectDataBase::elementInfoChanged(Element *element) { auto hash = elementInfoToString(element); - for (const auto& str : QETInformation::elementInfoKeys()) - { + for (auto str : QETInformation::elementInfoKeys()) { m_update_element_query.bindValue(":" + str, hash.value(str)); } m_update_element_query.bindValue(":uuid", element->uuid().toString()); @@ -541,8 +540,7 @@ void projectDataBase::prepareQuery() //UPDATE DIAGRAM INFO QString update_diagram_str("UPDATE diagram_info SET "); - for (const auto& str : QETInformation::diagramInfoKeys()) - { + for (auto str : QETInformation::diagramInfoKeys()) { update_diagram_str.append(str + " = :" + str + ", "); } update_diagram_str.remove(update_diagram_str.length()-2, 2); //Remove the last ", " @@ -582,8 +580,7 @@ void projectDataBase::prepareQuery() //UPDATE ELEMENT INFO QString update_str("UPDATE element_info SET "); - for (const auto& string : QETInformation::elementInfoKeys()) - { + for (auto string : QETInformation::elementInfoKeys()) { update_str.append(string + " = :" + string + ", "); } update_str.remove(update_str.length()-2, 2); //Remove the last ", " @@ -600,7 +597,7 @@ void projectDataBase::prepareQuery() QHash projectDataBase::elementInfoToString(Element *elmt) { QHash hash; //Store the value for each columns - for (const auto& key : QETInformation::elementInfoKeys()) + for (auto key : QETInformation::elementInfoKeys()) { if (key == "label") { hash.insert(key, elmt->actualLabel()); diff --git a/sources/dataBase/ui/elementquerywidget.cpp b/sources/dataBase/ui/elementquerywidget.cpp index 8538a03ea..ecdc6b5b4 100644 --- a/sources/dataBase/ui/elementquerywidget.cpp +++ b/sources/dataBase/ui/elementquerywidget.cpp @@ -130,9 +130,9 @@ void ElementQueryWidget::setQuery(const QString &query) //Get the select -> the item in the right list QStringList split = select.split(","); - for (const auto& str : std::as_const(split)) + for (auto str : split) { - for (auto item : std::as_const(m_items_list)) + for (auto item : m_items_list) { if (item->data(Qt::UserRole).toString() == str) { ui->m_var_list->takeItem(ui->m_var_list->row(item)); @@ -209,8 +209,7 @@ void ElementQueryWidget::setQuery(const QString &query) //Filter for selected data QStringList strl; - for (auto item : std::as_const(m_items_list)) - { + for (auto item : m_items_list) { strl.append(item->data(Qt::UserRole).toString()); } @@ -237,7 +236,7 @@ void ElementQueryWidget::setQuery(const QString &query) QRegularExpressionMatch rxm; - for (const auto& str : split_where) + for (auto str : split_where) { rxm = rx_is_not_null.match(str); if (rxm.hasMatch()) { @@ -298,8 +297,7 @@ QString ElementQueryWidget::queryStr() const QString column; bool first = true; - for (auto key : std::as_const(keys)) - { + for (auto key: keys) { if (first) { first = false; } else { @@ -456,7 +454,7 @@ QStringList ElementQueryWidget::selectedKeys() const */ void ElementQueryWidget::setUpItems() { - for (const QString& key : QETInformation::elementInfoKeys()) + for(QString key : QETInformation::elementInfoKeys()) { if (key == "formula") continue; @@ -466,7 +464,8 @@ void ElementQueryWidget::setUpItems() m_items_list << item; } - for (const auto& key : m_export_info.keys()) + + for (auto key : m_export_info.keys()) { auto item = new QListWidgetItem(m_export_info.value(key), ui->m_var_list); item->setData(Qt::UserRole, key); diff --git a/sources/dataBase/ui/summaryquerywidget.cpp b/sources/dataBase/ui/summaryquerywidget.cpp index c0274294d..efc2c1d5a 100644 --- a/sources/dataBase/ui/summaryquerywidget.cpp +++ b/sources/dataBase/ui/summaryquerywidget.cpp @@ -67,8 +67,7 @@ QString SummaryQueryWidget::queryStr() const QString column; bool first = true; - for (const auto& key : std::as_const(keys)) - { + for (auto key: keys) { if (first) { first = false; } else { @@ -105,9 +104,9 @@ void SummaryQueryWidget::setQuery(const QString &query) //Get the select -> the item in the right list QStringList split = select.split(","); - for (const auto& str : std::as_const(split)) + for (auto str : split) { - for (auto item : std::as_const(m_items_list)) + for (auto item : m_items_list) { if (item->data(Qt::UserRole).toString() == str) { ui->m_available_list->takeItem(ui->m_available_list->row(item)); @@ -124,7 +123,7 @@ void SummaryQueryWidget::setQuery(const QString &query) */ void SummaryQueryWidget::setUpItems() { - for (const auto& key : QETInformation::diagramInfoKeys()) + for (auto key : QETInformation::diagramInfoKeys()) { if (key == "filename" || key == "display_folio") { continue; diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 9a1de9e72..91cc9b660 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -377,7 +377,7 @@ void Diagram::keyPressEvent(QKeyEvent *event) switch(event->key()) { case Qt::Key_Left: - for (Element* item : std::as_const(dc.m_elements)) + for (Element *item : dc.m_elements) { left_position = item->sceneBoundingRect().x(); if(left_position <= 5) @@ -389,7 +389,7 @@ void Diagram::keyPressEvent(QKeyEvent *event) movement = QPointF(+xKeyGrid, 0.0); break; case Qt::Key_Up: - for (Element* item : std::as_const(dc.m_elements)) + for(Element *item : dc.m_elements) { top_position = item->sceneBoundingRect().y(); if(top_position <= 5) @@ -420,7 +420,7 @@ void Diagram::keyPressEvent(QKeyEvent *event) switch(event->key()) { case Qt::Key_Left: - for (Element* item : std::as_const(dc.m_elements)) + for (Element *item : dc.m_elements) { left_position = item->sceneBoundingRect().x(); if(left_position <= 5) @@ -432,7 +432,7 @@ void Diagram::keyPressEvent(QKeyEvent *event) movement = QPointF(+xKeyGridFine, 0.0); break; case Qt::Key_Up: - for (Element* item : std::as_const(dc.m_elements)) + for(Element *item : dc.m_elements) { top_position = item->sceneBoundingRect().y(); if(top_position <= 5) @@ -949,8 +949,7 @@ QDomDocument Diagram::toXml(bool whole_content) { if (!list_elements.isEmpty()) { auto dom_elements = document.createElement(QStringLiteral("elements")); - for (auto elmt : std::as_const(list_elements)) - { + for (auto elmt : list_elements) { dom_elements.appendChild(elmt->toXml(document, table_adr_id)); } @@ -959,8 +958,7 @@ QDomDocument Diagram::toXml(bool whole_content) { if (!list_conductors.isEmpty()) { auto dom_conductors = document.createElement(QStringLiteral("conductors")); - for (auto cond : std::as_const(list_conductors)) - { + for (auto cond : list_conductors) { dom_conductors.appendChild(cond->toXml(document, table_adr_id)); } @@ -969,8 +967,7 @@ QDomDocument Diagram::toXml(bool whole_content) { if (!list_texts.isEmpty()) { auto dom_texts = document.createElement(QStringLiteral("inputs")); - for (auto dti : std::as_const(list_texts)) - { + for (auto dti : list_texts) { dom_texts.appendChild(dti->toXml(document)); } dom_root.appendChild(dom_texts); @@ -978,8 +975,7 @@ QDomDocument Diagram::toXml(bool whole_content) { if (!list_images.isEmpty()) { auto dom_images = document.createElement(QStringLiteral("images")); - for (auto dii : std::as_const(list_images)) - { + for (auto dii : list_images) { dom_images.appendChild(dii->toXml(document)); } dom_root.appendChild(dom_images); @@ -987,8 +983,7 @@ QDomDocument Diagram::toXml(bool whole_content) { if (!list_shapes.isEmpty()) { auto dom_shapes = document.createElement(QStringLiteral("shapes")); - for (auto dii : std::as_const(list_shapes)) - { + for (auto dii : list_shapes) { dom_shapes.appendChild(dii -> toXml(document)); } dom_root.appendChild(dom_shapes); @@ -996,8 +991,7 @@ QDomDocument Diagram::toXml(bool whole_content) { if (table_vector.size()) { auto tables = document.createElement(QStringLiteral("tables")); - for (auto table : std::as_const(table_vector)) - { + for (auto table : table_vector) { tables.appendChild(table->toXml(document)); } dom_root.appendChild(tables); @@ -1382,11 +1376,9 @@ bool Diagram::fromXml(QDomElement &document, // Load text QList added_texts; - for (const auto& text_xml : QET::findInDomElement( - root, - QStringLiteral("inputs"), - QStringLiteral("input"))) - { + for (auto text_xml : QET::findInDomElement(root, + QStringLiteral("inputs"), + QStringLiteral("input"))) { IndependentTextItem *iti = new IndependentTextItem(); iti -> fromXml(text_xml); addItem(iti); @@ -1395,11 +1387,9 @@ bool Diagram::fromXml(QDomElement &document, // Load image QList added_images; - for (const auto& image_xml : QET::findInDomElement( - root, - QStringLiteral("images"), - QStringLiteral("image"))) - { + for (auto image_xml : QET::findInDomElement(root, + QStringLiteral("images"), + QStringLiteral("image"))) { DiagramImageItem *dii = new DiagramImageItem (); dii -> fromXml(image_xml); addItem(dii); @@ -1408,11 +1398,9 @@ bool Diagram::fromXml(QDomElement &document, // Load shape QList added_shapes; - for (const auto& shape_xml : QET::findInDomElement( - root, - QStringLiteral("shapes"), - QStringLiteral("shape"))) - { + for (auto shape_xml : QET::findInDomElement(root, + QStringLiteral("shapes"), + QStringLiteral("shape"))) { QetShapeItem *dii = new QetShapeItem (QPointF(0,0)); dii -> fromXml(shape_xml); addItem(dii); @@ -1475,8 +1463,7 @@ bool Diagram::fromXml(QDomElement &document, //Get the top left corner of the rectangle that contain all added items QRectF items_rect; - for (auto item : std::as_const(added_items)) - { + for (auto item : added_items) { items_rect = items_rect.united( item->mapToScene( item->boundingRect() @@ -1488,7 +1475,7 @@ bool Diagram::fromXml(QDomElement &document, position.y() - point_.y())); //Translate all added items - for (auto qgi : std::as_const(added_items)) + for (auto qgi : added_items) qgi->setPos(qgi->pos() += pos_); } @@ -1847,7 +1834,7 @@ void Diagram::changeZValue(QET::DepthOption option) DiagramContent::Shapes | \ DiagramContent::Images); QList list; - for (QGraphicsItem* item : std::as_const(l)) + for(QGraphicsItem *item : l) list << item->toGraphicsObject(); qreal maxz=0, @@ -1863,7 +1850,7 @@ void Diagram::changeZValue(QET::DepthOption option) if(option == QET::Raise) { - for (QGraphicsObject* qgo : std::as_const(list)) + for(QGraphicsObject *qgo : list) if(qgo->zValue() < (Terminal::Z-2)) //Ensure item is always below terminal new QPropertyUndoCommand(qgo, "z", @@ -1873,7 +1860,7 @@ void Diagram::changeZValue(QET::DepthOption option) } else if(option == QET::Lower) { - for (QGraphicsObject* qgo : std::as_const(list)) + for(QGraphicsObject *qgo : list) if(qgo->zValue() < (Terminal::Z-2)) //Ensure item is always below terminal new QPropertyUndoCommand(qgo, "z", @@ -1883,13 +1870,21 @@ void Diagram::changeZValue(QET::DepthOption option) } else if (option == QET::BringForward) { - for (QGraphicsObject* qgo : std::as_const(list)) - new QPropertyUndoCommand(qgo, "z", qgo->zValue(), maxz + 1, undo); + for(QGraphicsObject *qgo : list) + new QPropertyUndoCommand(qgo, + "z", + qgo->zValue(), + maxz+1, + undo); } else if(option == QET::SendBackward) { - for (QGraphicsObject* qgo : std::as_const(list)) - new QPropertyUndoCommand(qgo, "z", qgo->zValue(), minz - 1, undo); + for(QGraphicsObject *qgo : list) + new QPropertyUndoCommand(qgo, + "z", + qgo->zValue(), + minz-1, + undo); } if(undo->childCount()) diff --git a/sources/diagramcontent.cpp b/sources/diagramcontent.cpp index f60dacaf9..30bbcc5c1 100644 --- a/sources/diagramcontent.cpp +++ b/sources/diagramcontent.cpp @@ -95,7 +95,7 @@ DiagramContent::DiagramContent(Diagram *diagram, bool selected) : //For each selected element, we determine if conductors must be moved or updated. - for (Element* elmt : std::as_const(m_elements)) + for(Element *elmt : m_elements) { if (elmt->isSelected()) { @@ -176,7 +176,7 @@ QList DiagramContent::conductors(int filter) const if (filter & ConductorsToUpdate) result += m_conductors_to_update; if (filter & OtherConductors) result += m_other_conductors; if (filter & SelectedOnly) { - for (Conductor* conductor : std::as_const(result)) + for(Conductor *conductor : result) { if (!conductor->isSelected()) result.removeAll(conductor); diff --git a/sources/diagramcontext.cpp b/sources/diagramcontext.cpp index 330b223bc..681fed49e 100644 --- a/sources/diagramcontext.cpp +++ b/sources/diagramcontext.cpp @@ -31,7 +31,9 @@ */ void DiagramContext::add(DiagramContext other) { - for (const QString& key : other.keys()) { addValue(key, other.value(key)); } + for (QString key : other.keys()) { + addValue(key, other.value(key)); + } } /** @@ -256,8 +258,7 @@ bool DiagramContext::isKeyAcceptable(const QString &key) QDebug operator <<(QDebug debug, const DiagramContext &context) { debug << "DiagramContext"; - for (const auto& key : context.keys()) - { + for (auto key : context.keys()) { debug.nospace() << key << " : " << context.value(key) << "\n"; } debug << " end DiagramContext"; diff --git a/sources/editor/UndoCommand/pastepartscommand.cpp b/sources/editor/UndoCommand/pastepartscommand.cpp index 0a7a8b9f5..664039c2b 100644 --- a/sources/editor/UndoCommand/pastepartscommand.cpp +++ b/sources/editor/UndoCommand/pastepartscommand.cpp @@ -61,8 +61,7 @@ PastePartsCommand::~PastePartsCommand() void PastePartsCommand::undo() { m_scene->blockSignals(true); - for (auto qgi : std::as_const(m_pasted_content)) - { + for (auto qgi : m_pasted_content) { m_scene->removeItem(qgi); } m_scene->blockSignals(false); @@ -85,8 +84,7 @@ void PastePartsCommand::redo() m_first_redo = false; } else { m_scene->blockSignals(true); - for (auto qgi : std::as_const(m_pasted_content)) - { + for (auto qgi : m_pasted_content) { m_scene->addItem(qgi); } m_scene->blockSignals(false); diff --git a/sources/editor/arceditor.cpp b/sources/editor/arceditor.cpp index a3e9110a9..ec5bc51b4 100644 --- a/sources/editor/arceditor.cpp +++ b/sources/editor/arceditor.cpp @@ -93,9 +93,8 @@ void ArcEditor::setUpChangeConnections() void ArcEditor::disconnectChangeConnections() { - for (const QMetaObject::Connection& c : std::as_const(m_change_connections)) - { - disconnect(c); + for (QMetaObject::Connection c : m_change_connections) { + disconnect(c); } m_change_connections.clear(); } diff --git a/sources/editor/editorcommands.cpp b/sources/editor/editorcommands.cpp index 245defb70..100cc9a3d 100644 --- a/sources/editor/editorcommands.cpp +++ b/sources/editor/editorcommands.cpp @@ -521,7 +521,7 @@ ElementEditionCommand(QObject::tr("Pivoter la selection", "undo caption"), scene */ void RotateElementsCommand::undo() { - for (QGraphicsItem* item : std::as_const(m_items)) + for (QGraphicsItem *item : m_items) { if (item->type() == PartTerminal::Type) { PartTerminal* term = qgraphicsitem_cast(item); @@ -549,7 +549,7 @@ void RotateElementsCommand::undo() */ void RotateElementsCommand::redo() { - for (QGraphicsItem* item : std::as_const(m_items)) + for (QGraphicsItem *item : m_items) { if (item->type() == PartTerminal::Type) { PartTerminal* term = qgraphicsitem_cast(item); diff --git a/sources/editor/elementprimitivedecorator.cpp b/sources/editor/elementprimitivedecorator.cpp index 20cb1c2d3..28a89ff66 100644 --- a/sources/editor/elementprimitivedecorator.cpp +++ b/sources/editor/elementprimitivedecorator.cpp @@ -613,13 +613,13 @@ void ElementPrimitiveDecorator::addHandler() if (m_handler_vector.isEmpty() && scene()) { m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapFromScene(getResizingsPoints())); - - for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector)) - { - scene()->addItem(handler); - handler->setColor(Qt::darkGreen); - handler->installSceneEventFilter(this); - handler->setZValue(this->zValue() + 1); + + for(QetGraphicsHandlerItem *handler : m_handler_vector) + { + scene()->addItem(handler); + handler->setColor(Qt::darkGreen); + handler->installSceneEventFilter(this); + handler->setZValue(this->zValue()+1); } } } @@ -727,12 +727,12 @@ QVariant ElementPrimitiveDecorator::itemChange(QGraphicsItem::GraphicsItemChange else if (change == ItemVisibleHasChanged) { bool visible = value.toBool(); - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) + for(QetGraphicsHandlerItem *qghi : m_handler_vector) qghi->setVisible(visible); } else if (change == ItemZValueHasChanged && !m_handler_vector.isEmpty()) { - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) + for (QetGraphicsHandlerItem *qghi : m_handler_vector) qghi->setZValue(this->zValue()+1); } diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index 087f589da..c0bc81ab5 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -1099,7 +1099,7 @@ void ElementScene::reset() items_list << qgi; } - for (QGraphicsItem* qgi : std::as_const(items_list)) + for (QGraphicsItem *qgi : items_list) { removeItem(qgi); qgiManager().release(qgi); diff --git a/sources/editor/graphicspart/customelementgraphicpart.cpp b/sources/editor/graphicspart/customelementgraphicpart.cpp index 98af42a64..6e2966e47 100644 --- a/sources/editor/graphicspart/customelementgraphicpart.cpp +++ b/sources/editor/graphicspart/customelementgraphicpart.cpp @@ -530,7 +530,7 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde) //Check each pair of style QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$"); - for (const auto& style : std::as_const(styles)) + for (auto style : styles) { auto rx_match = rx.match(style); if (!rx_match.hasMatch()) { diff --git a/sources/editor/graphicspart/partarc.cpp b/sources/editor/graphicspart/partarc.cpp index 78211c56f..cb697d42c 100644 --- a/sources/editor/graphicspart/partarc.cpp +++ b/sources/editor/graphicspart/partarc.cpp @@ -265,7 +265,7 @@ void PartArc::switchResizeMode() if (m_resize_mode == 1) { m_resize_mode = 2; - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) + for (QetGraphicsHandlerItem *qghi : m_handler_vector) qghi->setColor(Qt::darkGreen); } else if (m_resize_mode == 2) @@ -276,7 +276,7 @@ void PartArc::switchResizeMode() removeHandler(); addHandler(); - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) + for (QetGraphicsHandlerItem *qghi : m_handler_vector) qghi->setColor(Qt::magenta); } else @@ -287,7 +287,7 @@ void PartArc::switchResizeMode() removeHandler(); addHandler(); - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) + for (QetGraphicsHandlerItem *qghi : m_handler_vector) qghi->setColor(Qt::blue); } } @@ -445,7 +445,7 @@ void PartArc::addHandler() else m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(QetGraphicsHandlerUtility::pointsForRect(m_rect))); - for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector)) + for(QetGraphicsHandlerItem *handler : m_handler_vector) { QColor color = Qt::blue; if (m_resize_mode == 2) diff --git a/sources/editor/graphicspart/partellipse.cpp b/sources/editor/graphicspart/partellipse.cpp index 2111a9011..9c2ed802b 100644 --- a/sources/editor/graphicspart/partellipse.cpp +++ b/sources/editor/graphicspart/partellipse.cpp @@ -241,13 +241,13 @@ void PartEllipse::switchResizeMode() if (m_resize_mode == 1) { m_resize_mode = 2; - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) + for (QetGraphicsHandlerItem *qghi : m_handler_vector) qghi->setColor(Qt::darkGreen); } else { m_resize_mode = 1; - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) + for (QetGraphicsHandlerItem *qghi : m_handler_vector) qghi->setColor(Qt::blue); } } @@ -334,7 +334,7 @@ void PartEllipse::addHandler() { m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(QetGraphicsHandlerUtility::pointsForRect(m_rect))); - for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector)) + for(QetGraphicsHandlerItem *handler : m_handler_vector) { QColor color = Qt::blue; if (m_resize_mode == 2) diff --git a/sources/editor/graphicspart/partline.cpp b/sources/editor/graphicspart/partline.cpp index ff678f794..0ad0e1e91 100644 --- a/sources/editor/graphicspart/partline.cpp +++ b/sources/editor/graphicspart/partline.cpp @@ -304,7 +304,7 @@ void PartLine::addHandler() m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(points_vector)); - for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector)) + for(QetGraphicsHandlerItem *handler : m_handler_vector) { handler->setColor(Qt::blue); scene()->addItem(handler); diff --git a/sources/editor/graphicspart/partpolygon.cpp b/sources/editor/graphicspart/partpolygon.cpp index 1ae843e88..08813a359 100644 --- a/sources/editor/graphicspart/partpolygon.cpp +++ b/sources/editor/graphicspart/partpolygon.cpp @@ -277,8 +277,7 @@ void PartPolygon::setClosed(bool close) */ void PartPolygon::setHandlerColor(QPointF pos, const QColor &color) { - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) - { + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { if (qghi->pos() == mapToScene(pos)) { qghi->setColor(color); } @@ -291,8 +290,7 @@ void PartPolygon::setHandlerColor(QPointF pos, const QColor &color) */ void PartPolygon::resetAllHandlerColor() { - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) - { + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { qghi->setColor(Qt::blue); } } @@ -382,7 +380,7 @@ void PartPolygon::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) list << m_insert_point; if (m_handler_vector.count() > 2) { - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { if (qghi->contains(qghi->mapFromScene(event->scenePos()))) { @@ -478,7 +476,7 @@ void PartPolygon::addHandler() { m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(m_polygon)); - for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector)) + for(QetGraphicsHandlerItem *handler : m_handler_vector) { handler->setColor(Qt::blue); scene()->addItem(handler); diff --git a/sources/editor/graphicspart/partrectangle.cpp b/sources/editor/graphicspart/partrectangle.cpp index 82eedccc5..6b5e39391 100644 --- a/sources/editor/graphicspart/partrectangle.cpp +++ b/sources/editor/graphicspart/partrectangle.cpp @@ -361,7 +361,7 @@ void PartRectangle::switchResizeMode() if (m_resize_mode == 1) { m_resize_mode = 2; - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) + for (QetGraphicsHandlerItem *qghi : m_handler_vector) qghi->setColor(Qt::darkGreen); } else if (m_resize_mode == 2) @@ -370,8 +370,7 @@ void PartRectangle::switchResizeMode() qDeleteAll(m_handler_vector); m_handler_vector.clear(); addHandler(); - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) - { + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { qghi->setColor(Qt::magenta); } } @@ -381,8 +380,7 @@ void PartRectangle::switchResizeMode() qDeleteAll(m_handler_vector); m_handler_vector.clear(); addHandler(); - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) - { + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { qghi->setColor(Qt::blue); } } @@ -514,7 +512,7 @@ void PartRectangle::addHandler() m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(QetGraphicsHandlerUtility::pointForRadiusRect(m_rect, m_xRadius, m_yRadius))); } - for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector)) + for (QetGraphicsHandlerItem *handler : m_handler_vector) { QColor color; if(m_resize_mode == 1) {color = Qt::blue;} diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index bdc194832..3b549c425 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -469,7 +469,7 @@ void StyleEditor::updateForm() size_weight -> setCurrentIndex(first_part -> lineWeight()); filling_color -> setCurrentIndex(first_part -> filling()); - for (auto cegp : std::as_const(m_part_list)) + for (auto cegp : m_part_list) { if (first_part -> antialiased() != cegp -> antialiased()) antialiasing -> setChecked(false); if (first_part -> color() != cegp -> color()) outline_color -> setCurrentIndex(-1); diff --git a/sources/editor/ui/dynamictextfieldeditor.cpp b/sources/editor/ui/dynamictextfieldeditor.cpp index 07a504b9c..b21c2039d 100644 --- a/sources/editor/ui/dynamictextfieldeditor.cpp +++ b/sources/editor/ui/dynamictextfieldeditor.cpp @@ -51,9 +51,7 @@ DynamicTextFieldEditor::~DynamicTextFieldEditor() { delete ui; if(!m_connection_list.isEmpty()) { - for (const QMetaObject::Connection& con : - std::as_const(m_connection_list)) - { + for(const QMetaObject::Connection& con : m_connection_list) { disconnect(con); } } @@ -205,8 +203,7 @@ void DynamicTextFieldEditor::disconnectConnections() { //Remove previous connection if(!m_connection_list.isEmpty()) - for (const auto& connection : std::as_const(m_connection_list)) - { + for(const auto &connection : m_connection_list) { disconnect(connection); } m_connection_list.clear(); diff --git a/sources/editor/ui/ellipseeditor.cpp b/sources/editor/ui/ellipseeditor.cpp index 82d7b1d66..7272c07ae 100644 --- a/sources/editor/ui/ellipseeditor.cpp +++ b/sources/editor/ui/ellipseeditor.cpp @@ -171,8 +171,7 @@ void EllipseEditor::setUpChangeConnections() */ void EllipseEditor::disconnectChangeConnections() { - for (const QMetaObject::Connection& c : std::as_const(m_change_connections)) - { + for (QMetaObject::Connection c : m_change_connections) { disconnect(c); } m_change_connections.clear(); diff --git a/sources/editor/ui/lineeditor.cpp b/sources/editor/ui/lineeditor.cpp index 20f8f3f45..e23333bfe 100644 --- a/sources/editor/ui/lineeditor.cpp +++ b/sources/editor/ui/lineeditor.cpp @@ -223,8 +223,7 @@ void LineEditor::setUpChangeConnections() */ void LineEditor::disconnectChangeConnections() { - for (const auto& connection : std::as_const(m_change_connections)) - { + for (auto connection : m_change_connections) { disconnect(connection); } diff --git a/sources/editor/ui/polygoneditor.cpp b/sources/editor/ui/polygoneditor.cpp index 9afdc35f5..d9003fc10 100644 --- a/sources/editor/ui/polygoneditor.cpp +++ b/sources/editor/ui/polygoneditor.cpp @@ -76,8 +76,7 @@ void PolygonEditor::setUpChangeConnections() void PolygonEditor::disconnectChangeConnections() { - for (const QMetaObject::Connection& c : std::as_const(m_change_connections)) - { + for (QMetaObject::Connection c : m_change_connections) { disconnect(c); } m_change_connections.clear(); diff --git a/sources/editor/ui/qetelementeditor.cpp b/sources/editor/ui/qetelementeditor.cpp index ceaea5d1f..2e0f2b34a 100644 --- a/sources/editor/ui/qetelementeditor.cpp +++ b/sources/editor/ui/qetelementeditor.cpp @@ -545,7 +545,7 @@ void QETElementEditor::updateInformations() QString selection_xml_name = part -> xmlName(); bool same_xml_name = true; bool style_editable = true; - for (QGraphicsItem* qgi : std::as_const(selected_qgis)) + for (QGraphicsItem *qgi: selected_qgis) { if (CustomElementPart *cep = dynamic_cast(qgi)) { cep_list << cep; @@ -582,11 +582,9 @@ void QETElementEditor::updateInformations() bool equal = true; QList parts = editor -> currentParts(); if (parts.length() == cep_list.length()) { - for (auto cep : std::as_const(cep_list)) - { + for (auto cep: cep_list) { bool part_found = false; - for (auto part : std::as_const(parts)) - { + for (auto part: parts) { if (part == cep) { part_found = true; break; @@ -791,12 +789,12 @@ bool QETElementEditor::checkElement() dialog_message += "
    "; QList total = warnings << errors; - for (const QETWarning& warning : total) + for(QETWarning warning : total) { dialog_message += "
  1. "; - dialog_message += - QString(tr("%1 : %2", "warning title: warning description")) - .arg(warning.first, warning.second); + dialog_message += QString( + tr("%1 : %2", "warning title: warning description") + ).arg(warning.first).arg(warning.second); dialog_message += "
  2. "; } dialog_message += "
"; diff --git a/sources/editor/ui/rectangleeditor.cpp b/sources/editor/ui/rectangleeditor.cpp index 9be037bff..2380f35a1 100644 --- a/sources/editor/ui/rectangleeditor.cpp +++ b/sources/editor/ui/rectangleeditor.cpp @@ -59,8 +59,7 @@ void RectangleEditor::setUpChangeConnections() void RectangleEditor::disconnectChangeConnections() { - for (const QMetaObject::Connection& c : std::as_const(m_change_connections)) - { + for (QMetaObject::Connection c : m_change_connections) { disconnect(c); } m_change_connections.clear(); diff --git a/sources/editor/ui/texteditor.cpp b/sources/editor/ui/texteditor.cpp index 67c5aced6..b088e6571 100644 --- a/sources/editor/ui/texteditor.cpp +++ b/sources/editor/ui/texteditor.cpp @@ -92,9 +92,8 @@ void TextEditor::disconnectChangeConnection() void TextEditor::disconnectEditConnection() { - for (const QMetaObject::Connection& c : std::as_const(m_edit_connection)) - { - disconnect(c); + for (QMetaObject::Connection c : m_edit_connection) { + disconnect(c); } m_edit_connection.clear(); } diff --git a/sources/elementprovider.cpp b/sources/elementprovider.cpp index de73148db..fdf89c049 100644 --- a/sources/elementprovider.cpp +++ b/sources/elementprovider.cpp @@ -153,8 +153,7 @@ QVector ElementProvider::table( } } - for (auto d : std::as_const(m_diagram_list)) - { + for (auto d : m_diagram_list) { for (auto item_ : d->items()) { if(item_->type() == QetGraphicsTableItem::Type) diff --git a/sources/elementspanel.cpp b/sources/elementspanel.cpp index 69769f772..30925b6e9 100644 --- a/sources/elementspanel.cpp +++ b/sources/elementspanel.cpp @@ -58,8 +58,8 @@ ElementsPanel::ElementsPanel(QWidget *parent) : QPalette qp = palette(); qp.setColor(QPalette::Text, Qt::black); qp.setColor(QPalette::Base, Qt::white); - qp.setColor(QPalette::AlternateBase, QColor(0xe8e8e8)); - qp.setColor(QPalette::Highlight, QColor(0x678db2)); + qp.setColor(QPalette::AlternateBase, QColor("#e8e8e8")); + qp.setColor(QPalette::Highlight, QColor("#678db2")); qp.setColor(QPalette::HighlightedText, Qt::black); setPalette(qp); diff --git a/sources/elementtextpattern.cpp b/sources/elementtextpattern.cpp index 600fe5e67..f76fae68b 100644 --- a/sources/elementtextpattern.cpp +++ b/sources/elementtextpattern.cpp @@ -220,7 +220,7 @@ void ImportElementTextPattern::apply(QString name, bool erase) const //Replace the original uuid of texts in the xml description, by a new one for every texts QHash uuid_hash; - for (QDomElement text : std::as_const(texts)) + for(QDomElement text : texts) { QUuid original_uuid(text.attribute("uuid")); QUuid new_uuid = QUuid::createUuid(); @@ -231,7 +231,7 @@ void ImportElementTextPattern::apply(QString name, bool erase) const //In each group of the xml description, replace the original uuids, by the news created upper. QList groups = QET::findInDomElement(root, "texts_groups", "texts_group"); - for (const QDomElement& group : std::as_const(groups)) + for(const QDomElement& group : groups) { for(QDomElement text : QET::findInDomElement(group, "texts", "text")) { @@ -260,14 +260,14 @@ void ImportElementTextPattern::apply(QString name, bool erase) const } //Add the texts to element - for (const QDomElement& text : std::as_const(texts)) + for(const QDomElement& text : texts) { DynamicElementTextItem *deti = new DynamicElementTextItem(m_element); undo_stack.push(new AddElementTextCommand(m_element, deti)); deti->fromXml(text); } //Add the groups to element - for (const QDomElement& xml_group : std::as_const(groups)) + for(const QDomElement& xml_group : groups) undo_stack.push(new AddTextsGroupCommand(m_element, xml_group)); undo_stack.endMacro(); diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 91a681047..2e593ed75 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -505,7 +505,7 @@ void ExportDialog::generateDxf( ElementPictureFactory::primitives primitives = ElementPictureFactory::instance()->getPrimitives(elmt->location()); - for (QGraphicsSimpleTextItem* text : std::as_const(primitives.m_texts)) + for(QGraphicsSimpleTextItem *text : primitives.m_texts) { qreal fontSize = text->font().pointSizeF(); if (fontSize < 0) @@ -524,7 +524,7 @@ void ExportDialog::generateDxf( y = transformed_point.y() - xdir * fontSize * 0.5; QStringList lines = text->text().split('\n'); qreal offset = fontSize * 1.6; - for (const QString& line : std::as_const(lines)) + for (QString line : lines) { if (line.size() > 0 && line != "_" ) { Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360 - angle, 0, 0.72); @@ -534,29 +534,28 @@ void ExportDialog::generateDxf( } } - for (QLineF line : std::as_const(primitives.m_lines)) + for (QLineF line : primitives.m_lines) { QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle); QLineF l = t.map(line); Createdxf::drawLine(file_path, l, 0); } - for (QRectF rect : std::as_const(primitives.m_rectangles)) + for (QRectF rect : primitives.m_rectangles) { QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle); QRectF r = t.mapRect(rect); Createdxf::drawRectangle(file_path,r,0); } - for (QRectF circle_rect : std::as_const(primitives.m_circles)) + for (QRectF circle_rect : primitives.m_circles) { QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle); QPointF c = t.map(QPointF(circle_rect.center().x(),circle_rect.center().y())); Createdxf::drawCircle(file_path,c,circle_rect.width()/2,0); } - for (const QVector& polygon : - std::as_const(primitives.m_polygons)) + for (QVector polygon : primitives.m_polygons) { if (polygon.size() == 0) continue; @@ -569,7 +568,7 @@ void ExportDialog::generateDxf( } // Draw arcs and ellipses - for (const QVector& arc : std::as_const(primitives.m_arcs)) + for (QVector arc : primitives.m_arcs) { if (arc.size() == 0) continue; diff --git a/sources/factory/elementpicturefactory.cpp b/sources/factory/elementpicturefactory.cpp index d896611b2..522c1a721 100644 --- a/sources/factory/elementpicturefactory.cpp +++ b/sources/factory/elementpicturefactory.cpp @@ -130,8 +130,7 @@ ElementPictureFactory::primitives ElementPictureFactory::getPrimitives( ElementPictureFactory::~ElementPictureFactory() { - for (const primitives& p : m_primitives_H.values()) - { + for (primitives p : m_primitives_H.values()) { qDeleteAll(p.m_texts); } } @@ -581,7 +580,7 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa << rx.patternErrorOffset(); return; } - for (const auto& style : styles) + for (auto style : styles) { QRegularExpressionMatch match = rx.match(style); if (!match.hasMatch()) { diff --git a/sources/genericpanel.cpp b/sources/genericpanel.cpp index e28590d1b..fd6103313 100644 --- a/sources/genericpanel.cpp +++ b/sources/genericpanel.cpp @@ -356,12 +356,14 @@ QTreeWidgetItem *GenericPanel::updateDiagramItem(QTreeWidgetItem *diagram_qtwi, int diagram_folio_idx = diagram -> folioIndex(); if (diagram_folio_idx != -1) { - displayed_label = - QString(tr("%1 - %2", - "label displayed for a diagram in the panel ;" - " %1 is the folio index, %2 is the diagram title")) - .arg(displayed_label, displayed_title); - diagram_qtwi->setText(0, displayed_label); + displayed_label = QString( + tr( + "%1 - %2", + "label displayed for a diagram in the panel ;" + " %1 is the folio index, %2 is the diagram title" + ) + ).arg(displayed_label).arg(displayed_title); + diagram_qtwi -> setText(0, displayed_label); } } @@ -908,8 +910,8 @@ void GenericPanel::deleteItem(QTreeWidgetItem *item, bool deleted_on_cascade) { */ void GenericPanel::markItemAsUnused(QTreeWidgetItem *qtwi) { QLinearGradient t(0, 0, 200, 0); - t.setColorAt(0, QColor(0xffc0c0)); - t.setColorAt(1, QColor(0xffffff)); + t.setColorAt(0, QColor("#ffc0c0")); + t.setColorAt(1, QColor("#ffffff")); qtwi -> setBackground(0, QBrush(t)); qtwi -> setToolTip(0, QString(tr("%1 [non utilisé dans le projet]")).arg( diff --git a/sources/print/projectprintwindow.cpp b/sources/print/projectprintwindow.cpp index 171b45d4e..6522020d3 100644 --- a/sources/print/projectprintwindow.cpp +++ b/sources/print/projectprintwindow.cpp @@ -309,7 +309,7 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter //Scrolls through the page for print bool first_ = true; - for (auto page : std::as_const(page_to_print)) + for (auto page : page_to_print) { first_ ? first_ = false : m_printer->newPage(); diagram->render(painter, QRect(QPoint(0,0), page.size()), page.translated(diagram_rect.topLeft()), Qt::KeepAspectRatio); @@ -320,8 +320,7 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter for (auto view : diagram->views()) { view->setInteractive(true); } - for (auto qgi : std::as_const(focusable_items)) - { + for (auto qgi : focusable_items) { qgi->setFlag(QGraphicsItem::ItemIsFocusable, true); } saveReloadDiagramParameters(diagram, option, false); diff --git a/sources/properties/xrefproperties.cpp b/sources/properties/xrefproperties.cpp index 09b100265..2ce72747e 100644 --- a/sources/properties/xrefproperties.cpp +++ b/sources/properties/xrefproperties.cpp @@ -89,8 +89,7 @@ void XRefProperties::fromSettings(const QSettings &settings, QMetaEnum var = QMetaEnum::fromType(); m_xref_pos = Qt::AlignmentFlag(var.keyToValue((settings.value(prefix + "xrefpos").toString()).toStdString().data())); - for (const QString& key : std::as_const(m_prefix_keys)) - { + for (QString key : m_prefix_keys) { m_prefix.insert(key, settings.value(prefix + key + "prefix").toString()); } } diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 6d1ef5af7..8967347ae 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -2405,7 +2405,7 @@ void QETApp::checkBackupFiles() text.append(tr("Les fichiers de restauration suivant on été trouvé,
" "Voulez-vous les ouvrir ?

")); } - for (const KAutoSaveFile* kasf : std::as_const(stale_files)) + for(const KAutoSaveFile *kasf : stale_files) { # ifdef Q_OS_WIN //Remove the first character '/' before the name of the drive @@ -2439,7 +2439,7 @@ void QETApp::checkBackupFiles() else //Clear backup file { //Remove the stale files - for (KAutoSaveFile* stale : std::as_const(stale_files)) + for (KAutoSaveFile *stale : stale_files) { stale->open(QIODevice::ReadWrite); delete stale; diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index a1a622ccc..ad941588f 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -929,10 +929,7 @@ void QETDiagramEditor::save() QString title = (project_view -> project() -> title ()); if (title.isEmpty()) title = "QElectroTech "; QString filePath = (project_view -> project() -> filePath ()); - statusBar()->showMessage( - tr("Projet %1 enregistré dans le repertoire: %2.") - .arg(title, filePath), - 2000); + statusBar()-> showMessage(tr("Projet %1 enregistré dans le repertoire: %2.").arg(title).arg (filePath), 2000); m_element_collection_widget->highlightUnusedElement(); } else { @@ -955,10 +952,7 @@ void QETDiagramEditor::saveAs() QString title = (project_view -> project() -> title ()); if (title.isEmpty()) title = "QElectroTech "; QString filePath = (project_view -> project() -> filePath ()); - statusBar()->showMessage( - tr("Projet %1 enregistré dans le repertoire: %2.") - .arg(title, filePath), - 2000); + statusBar()->showMessage(tr("Projet %1 enregistré dans le repertoire: %2.").arg(title).arg (filePath), 2000); m_element_collection_widget->highlightUnusedElement(); } else { @@ -1620,7 +1614,7 @@ void QETDiagramEditor::slot_updateComplexActions() << m_rotate_selection << m_edit_selection << m_group_selected_texts; - for (QAction* action : std::as_const(action_list)) + for(QAction *action : action_list) action->setEnabled(false); return; @@ -1652,13 +1646,13 @@ void QETDiagramEditor::slot_updateComplexActions() QList groups = DiagramContent(diagram_).selectedTextsGroup(); int selected_texts = texts.count(); int selected_conductor_texts = 0; - for (DiagramTextItem* dti : std::as_const(texts)) + for(DiagramTextItem *dti : texts) { if(dti->type() == ConductorTextItem::Type) selected_conductor_texts++; } int selected_dynamic_elmt_text = 0; - for (DiagramTextItem* dti : std::as_const(texts)) + for(DiagramTextItem *dti : texts) { if(dti->type() == DynamicElementTextItem::Type) selected_dynamic_elmt_text++; @@ -1671,7 +1665,7 @@ void QETDiagramEditor::slot_updateComplexActions() { Element *elmt = deti_list.first()->parentElement(); bool ok = true; - for (DynamicElementTextItem* deti : std::as_const(deti_list)) + for(DynamicElementTextItem *deti : deti_list) { if(elmt != deti->parentElement()) ok = false; diff --git a/sources/qetgraphicsitem/ViewItem/qetgraphicsheaderitem.cpp b/sources/qetgraphicsitem/ViewItem/qetgraphicsheaderitem.cpp index c0cf638f8..ba64c8221 100644 --- a/sources/qetgraphicsitem/ViewItem/qetgraphicsheaderitem.cpp +++ b/sources/qetgraphicsitem/ViewItem/qetgraphicsheaderitem.cpp @@ -133,7 +133,7 @@ void QetGraphicsHeaderItem::paint( //Draw vertical lines auto offset= 0; - for (auto size : std::as_const(m_current_sections_width)) + for(auto size : m_current_sections_width) { QPointF p1(offset+size, m_current_rect.top()); QPointF p2(offset+size, m_current_rect.bottom()); @@ -188,7 +188,7 @@ bool QetGraphicsHeaderItem::toDXF(const QString &filepath) //Draw vertical lines auto offset= 0; - for (auto size : std::as_const(m_current_sections_width)) + for(auto size : m_current_sections_width) { QPointF p1(offset+size, m_current_rect.top()); QPointF p2(offset+size, m_current_rect.bottom()); diff --git a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp index eb1fc3ff9..5ea8364bf 100644 --- a/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp +++ b/sources/qetgraphicsitem/ViewItem/ui/graphicstablepropertieseditor.cpp @@ -75,7 +75,9 @@ GraphicsTablePropertiesEditor::~GraphicsTablePropertiesEditor() void GraphicsTablePropertiesEditor::setTable(QetGraphicsTableItem *table) { if (m_table_item) { - for (const auto& c : std::as_const(m_connect_list)) { disconnect(c); } + for (auto c : m_connect_list) { + disconnect(c); + } if (m_current_model_editor) { ui->m_content_layout->removeWidget(m_current_model_editor); @@ -306,11 +308,9 @@ void GraphicsTablePropertiesEditor::updateUi() { //Disconnect every connections of editor widgets //to avoid an unwanted edition (QSpinBox emit valueChanged no matter if changer by user or by program) - for (const QMetaObject::Connection& c : - std::as_const(m_edit_connection)) - { - disconnect(c); - } + for (QMetaObject::Connection c : m_edit_connection) { + disconnect(c); + } m_edit_connection.clear(); ui->m_next_pb->setEnabled(m_table_item->nextTable()); @@ -433,8 +433,7 @@ void GraphicsTablePropertiesEditor::updateInfoLabel() */ void GraphicsTablePropertiesEditor::setUpEditConnection() { - for (const QMetaObject::Connection& c : std::as_const(m_edit_connection)) - { + for (QMetaObject::Connection c : m_edit_connection) { disconnect(c); } @@ -543,7 +542,7 @@ void GraphicsTablePropertiesEditor::on_m_apply_geometry_to_linked_table_pb_click auto new_displayN_row = m_table_item->displayNRow(); //Apply to all linked table auto parent_undo = new QUndoCommand(tr("Appliquer la géometrie d'un tableau aux tableau liée à celui-ci")); - for (auto table : std::as_const(vector_)) + for (auto table : vector_) { new QPropertyUndoCommand(table, "pos", table->pos(), new_pos, parent_undo); new QPropertyUndoCommand(table, "size", table->size(), new_size, parent_undo); diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index 22e928619..ab22bcbf5 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -803,7 +803,7 @@ void Conductor::handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSc m_moved_segment = segmentsList().at(m_vector_index+1); before_mov_text_pos_ = m_text_item -> pos(); - for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector)) + for(QetGraphicsHandlerItem *handler : m_handler_vector) if(handler != qghi) handler->hide(); } @@ -871,7 +871,7 @@ void Conductor::addHandler() { m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(handlerPoints()), QETUtils::graphicsHandlerSize(this)); - for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector)) + for(QetGraphicsHandlerItem *handler : m_handler_vector) { handler->setColor(Qt::blue); scene()->addItem(handler); @@ -1703,7 +1703,7 @@ QSet Conductor::relatedPotentialConductors(const bool all_diagram, this_terminal << terminal1 << terminal2; // Return all conductors of terminal 1 and 2 - for (Terminal* terminal : std::as_const(this_terminal)) + for (Terminal *terminal : this_terminal) { if (!t_list->contains(terminal)) { @@ -1723,8 +1723,7 @@ QSet Conductor::relatedPotentialConductors(const bool all_diagram, other_conductors_list_t.removeAll(this); //Get the conductors at the same potential for each conductors of other_conductors_list_t - for (Conductor* c : std::as_const(other_conductors_list_t)) - { + for (Conductor *c : other_conductors_list_t) { other_conductors += c->relatedPotentialConductors(all_diagram, t_list); } #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove @@ -2017,7 +2016,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath QList lines; QList points; - for (const QPolygonF& polygon : polygons) + for (QPolygonF polygon : polygons) { if (polygon.count() <= 1) continue; @@ -2032,7 +2031,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath // we make orthogonal projections of the point on the different // segments of the polygon, sorting them by increasing length QMap intersections; - for (QLineF line : std::as_const(lines)) + for (QLineF line : lines) { QPointF intersection_point; if (QET::orthogonalProjection(point, line, &intersection_point)) { diff --git a/sources/qetgraphicsitem/crossrefitem.cpp b/sources/qetgraphicsitem/crossrefitem.cpp index b7ab74fd1..98d941c6a 100644 --- a/sources/qetgraphicsitem/crossrefitem.cpp +++ b/sources/qetgraphicsitem/crossrefitem.cpp @@ -98,7 +98,7 @@ void CrossRefItem::init() */ void CrossRefItem::setUpConnection() { - for (const QMetaObject::Connection& c : std::as_const(m_update_connection)) + for(const QMetaObject::Connection& c : m_update_connection) disconnect(c); m_update_connection.clear(); @@ -424,7 +424,7 @@ void CrossRefItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) */ void CrossRefItem::linkedChanged() { - for (const QMetaObject::Connection& c : std::as_const(m_slave_connection)) + for(const QMetaObject::Connection& c : m_slave_connection) disconnect(c); m_slave_connection.clear(); @@ -524,7 +524,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) //Bounding rect of the NO text QRectF no_bounding; - for (const auto& str : no_str) + for (auto str : no_str) { QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str); no_bounding = no_bounding.united(bounding); @@ -538,7 +538,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter) //Bounding rect of the NC text QRectF nc_bounding; - for (const auto& str : nc_str) + for (auto str : nc_str) { QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str); nc_bounding = nc_bounding.united(bounding); diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index e6f2521d0..17c4369b4 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -1000,8 +1000,7 @@ void DynamicElementTextItem::setupFormulaConnection() void DynamicElementTextItem::clearFormulaConnection() { - for (const QMetaObject::Connection& con : - std::as_const(m_formula_connection)) + for (const QMetaObject::Connection& con : m_formula_connection) disconnect(con); m_formula_connection.clear(); } diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index a321456b3..8a20472e6 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -732,7 +732,7 @@ bool Element::fromXml(QDomElement &e, { if (auto terminal_ = qgraphicsitem_cast(qgi)) { - for (auto qde : std::as_const(liste_terminals)) + for(auto qde : liste_terminals) { if (terminal_ -> fromXml(qde)) { @@ -812,7 +812,7 @@ bool Element::fromXml(QDomElement &e, //Before loading the dynamic text field, //we remove the dynamic text field created from the description of this element, to avoid doublons. - for (DynamicElementTextItem* deti : std::as_const(m_dynamic_text_list)) + for(DynamicElementTextItem *deti : m_dynamic_text_list) delete deti; m_dynamic_text_list.clear(); @@ -868,10 +868,10 @@ bool Element::fromXml(QDomElement &e, //We must block the update of the alignment when loading the information //otherwise the pos of the text will not be the same as it was at save time. - for (DynamicElementTextItem* deti : std::as_const(m_dynamic_text_list)) + for(DynamicElementTextItem *deti : m_dynamic_text_list) deti->m_block_alignment = true; setElementInformations(dc); - for (DynamicElementTextItem* deti : std::as_const(m_dynamic_text_list)) + for(DynamicElementTextItem *deti : m_dynamic_text_list) deti->m_block_alignment = false; m_state = QET::GIOK; @@ -1011,15 +1011,15 @@ QDomElement Element::toXml( //Remove the texts from group QList deti_list = group->texts(); - for (DynamicElementTextItem* deti : std::as_const(deti_list)) + for(DynamicElementTextItem *deti : deti_list) group->removeFromGroup(deti); //Save the texts to xml - for (DynamicElementTextItem* deti : std::as_const(deti_list)) + for (DynamicElementTextItem *deti : deti_list) dyn_text.appendChild(deti->toXml(document)); //Re add texts to group - for (DynamicElementTextItem* deti : std::as_const(deti_list)) + for(DynamicElementTextItem *deti : deti_list) group->addToGroup(deti); //Restorr the alignment @@ -1079,7 +1079,7 @@ void Element::removeDynamicTextItem(DynamicElementTextItem *deti) return; } - for (ElementTextItemGroup* group : std::as_const(m_texts_group)) + for(ElementTextItemGroup *group : m_texts_group) { if(group->texts().contains(deti)) { diff --git a/sources/qetgraphicsitem/elementtextitemgroup.cpp b/sources/qetgraphicsitem/elementtextitemgroup.cpp index 38d2b999d..4a4f8a3e9 100644 --- a/sources/qetgraphicsitem/elementtextitemgroup.cpp +++ b/sources/qetgraphicsitem/elementtextitemgroup.cpp @@ -214,7 +214,7 @@ void ElementTextItemGroup::updateAlignment() else if (texts.size() > 1) { qreal width = 0; - for (QGraphicsItem* item : std::as_const(texts)) + for(QGraphicsItem *item : texts) if(item->boundingRect().width() > width) width = item->boundingRect().width(); @@ -226,8 +226,8 @@ void ElementTextItemGroup::updateAlignment() if(m_alignment == Qt::AlignLeft) { QPointF ref = texts.first()->pos(); - - for (QGraphicsItem* item : std::as_const(texts)) + + for(QGraphicsItem *item : texts) { item->setPos(0, ref.y()+y_offset); y_offset+=item->boundingRect().height() + m_vertical_adjustment; @@ -236,8 +236,8 @@ void ElementTextItemGroup::updateAlignment() else if(m_alignment == Qt::AlignVCenter) { QPointF ref(width/2,0); - - for (QGraphicsItem* item : std::as_const(texts)) + + for(QGraphicsItem *item : texts) { item->setPos(ref.x() - item->boundingRect().width()/2, ref.y() + y_offset); @@ -247,8 +247,8 @@ void ElementTextItemGroup::updateAlignment() else if (m_alignment == Qt::AlignRight) { QPointF ref(width,0); - - for (QGraphicsItem* item : std::as_const(texts)) + + for(QGraphicsItem *item : texts) { item->setPos(ref.x() - item->boundingRect().width(), ref.y() + y_offset); diff --git a/sources/qetgraphicsitem/qetshapeitem.cpp b/sources/qetgraphicsitem/qetshapeitem.cpp index d78354662..aaeff3d6e 100644 --- a/sources/qetgraphicsitem/qetshapeitem.cpp +++ b/sources/qetgraphicsitem/qetshapeitem.cpp @@ -49,14 +49,11 @@ QetShapeItem::QetShapeItem(QPointF p1, QPointF p2, ShapeType type, QGraphicsItem setAcceptHoverEvents(true); m_pen.setStyle(Qt::SolidLine); //ensure handlers are always above this item - connect( - this, - &QetShapeItem::zChanged, - [this]() - { - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) - qghi->setZValue(this->zValue() + 1); - }); + connect(this, &QetShapeItem::zChanged, [this]() + { + for(QetGraphicsHandlerItem *qghi : m_handler_vector) + qghi->setZValue(this->zValue()+1); + }); m_insert_point = new QAction(tr("Ajouter un point"), this); m_insert_point->setIcon(QET::Icons::Add); @@ -490,8 +487,7 @@ void QetShapeItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) if (m_handler_vector.count() > 2) { - for (QetGraphicsHandlerItem* qghi : - std::as_const(m_handler_vector)) + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { if (qghi->contains(qghi->mapFromScene(event->scenePos()))) { @@ -524,16 +520,14 @@ void QetShapeItem::switchResizeMode() if (m_resize_mode == 1) { m_resize_mode = 2; - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) - { + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { qghi->setColor(Qt::darkGreen); } } else { m_resize_mode = 1; - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) - { + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { qghi->setColor(Qt::blue); } } @@ -543,7 +537,7 @@ void QetShapeItem::switchResizeMode() if (m_resize_mode == 1) { m_resize_mode = 2; - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) + for (QetGraphicsHandlerItem *qghi : m_handler_vector) qghi->setColor(Qt::darkGreen); } else if (m_resize_mode == 2) @@ -552,8 +546,7 @@ void QetShapeItem::switchResizeMode() qDeleteAll(m_handler_vector); m_handler_vector.clear(); addHandler(); - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) - { + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { qghi->setColor(Qt::magenta); } } @@ -563,10 +556,10 @@ void QetShapeItem::switchResizeMode() qDeleteAll(m_handler_vector); m_handler_vector.clear(); addHandler(); - for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector)) - { + for (QetGraphicsHandlerItem *qghi : m_handler_vector) { qghi->setColor(Qt::blue); } + } } } diff --git a/sources/qetgraphicsitem/terminal.cpp b/sources/qetgraphicsitem/terminal.cpp index ae7eb13b9..b0028a0dc 100644 --- a/sources/qetgraphicsitem/terminal.cpp +++ b/sources/qetgraphicsitem/terminal.cpp @@ -29,7 +29,7 @@ QColor Terminal::neutralColor = QColor(Qt::blue); QColor Terminal::allowedColor = QColor(Qt::darkGreen); -QColor Terminal::warningColor = QColor(0xff8000); +QColor Terminal::warningColor = QColor("#ff8000"); QColor Terminal::forbiddenColor = QColor(Qt::red); const qreal Terminal::terminalSize = 4.0; const qreal Terminal::Z = 1000; diff --git a/sources/qetinformation.cpp b/sources/qetinformation.cpp index 25d384459..c180644f0 100644 --- a/sources/qetinformation.cpp +++ b/sources/qetinformation.cpp @@ -73,8 +73,7 @@ QString QETInformation::titleblockInfoKeysToVar(const QString &info) QHash QETInformation::titleblockTranslatedKeyHashVar() { QHash hash_; - for (const QString& str : titleblockInfoKeys()) - { + for (QString str : titleblockInfoKeys()) { hash_.insert(translatedInfoKey(str), titleblockInfoKeysToVar(str)); } return hash_; diff --git a/sources/qetxml.cpp b/sources/qetxml.cpp index a21fb54e0..dde86d6c9 100644 --- a/sources/qetxml.cpp +++ b/sources/qetxml.cpp @@ -516,7 +516,7 @@ void QETXML::modelHeaderDataFromXml( auto meta_enum_orientation = QMetaEnum::fromType(); auto meta_enum_role = QMetaEnum::fromType(); - for (const auto& child : QETXML::directChild(element, "data")) + for (auto child : QETXML::directChild(element, "data")) { auto section_ = child.attribute("section", "-1").toInt(); auto orientation_ = Qt::Orientation( diff --git a/sources/qtextorientationwidget.cpp b/sources/qtextorientationwidget.cpp index ab232af32..110fea82f 100644 --- a/sources/qtextorientationwidget.cpp +++ b/sources/qtextorientationwidget.cpp @@ -201,8 +201,8 @@ void QTextOrientationWidget::paintEvent(QPaintEvent *event) { p.setRenderHint(QPainter::TextAntialiasing, true); // cercle gris a fond jaune - p.setPen(QPen(QBrush(QColor(0x9FA8A8)), 2.0)); - p.setBrush(QBrush(QColor(0xffffaa))); + p.setPen(QPen(QBrush(QColor("#9FA8A8")), 2.0)); + p.setBrush(QBrush(QColor("#ffffaa"))); p.drawEllipse(drawing_rectangle); // ligne rouge indiquant l'angle actuel @@ -230,10 +230,10 @@ void QTextOrientationWidget::paintEvent(QPaintEvent *event) { qreal square_offset = - squares_size / 2.0; QRectF square_qrect = QRect(square_offset, square_offset, squares_size, squares_size); p.setPen(Qt::NoPen); - p.setBrush(QBrush(QColor(0x248A34))); + p.setBrush(QBrush(QColor("#248A34"))); for (double drawing_angle = 0.0 ; drawing_angle < 360.0 ; drawing_angle += squares_interval_) { if (must_highlight_angle_ && highlight_angle_ == drawing_angle && underMouse()) { - p.setBrush(QBrush(QColor(0x43FF5F))); + p.setBrush(QBrush(QColor("#43FF5F"))); } p.resetTransform(); p.translate(drawing_rectangle_center); @@ -242,7 +242,7 @@ void QTextOrientationWidget::paintEvent(QPaintEvent *event) { p.rotate(-45.0); p.drawRect(square_qrect); if (must_highlight_angle_ && highlight_angle_ == drawing_angle) { - p.setBrush(QBrush(QColor(0x248A34))); + p.setBrush(QBrush(QColor("#248A34"))); } } diff --git a/sources/titleblock/helpercell.cpp b/sources/titleblock/helpercell.cpp index 6b23e0a4e..02d6ca5cd 100644 --- a/sources/titleblock/helpercell.cpp +++ b/sources/titleblock/helpercell.cpp @@ -96,13 +96,13 @@ void HelperCell::paint(QPainter *painter, const QStyleOptionGraphicsItem *option */ void HelperCell::setType(QET::TitleBlockColumnLength type) { if (type == QET::Absolute) { - background_color = QColor(0xC0FFFF); + background_color = QColor("#C0FFFF"); foreground_color = Qt::black; } else if (type == QET::RelativeToTotalLength) { - background_color = QColor(0xFFA858); + background_color = QColor("#FFA858"); foreground_color = Qt::black; } else if (type == QET::RelativeToRemainingLength) { - background_color = QColor(0xFFC0C0); + background_color = QColor("#FFC0C0"); foreground_color = Qt::black; } } diff --git a/sources/titleblock/integrationmovetemplateshandler.cpp b/sources/titleblock/integrationmovetemplateshandler.cpp index 0bf5225da..be6e759b8 100644 --- a/sources/titleblock/integrationmovetemplateshandler.cpp +++ b/sources/titleblock/integrationmovetemplateshandler.cpp @@ -82,15 +82,14 @@ QET::Action IntegrationMoveTitleBlockTemplatesHandler::templateAlreadyExists(con @param message Error message. */ QET::Action IntegrationMoveTitleBlockTemplatesHandler::errorWithATemplate(const TitleBlockTemplateLocation &tbt, const QString &message) { - QString error_message = - QString("Une erreur s'est produite avec le modèle %1 : %2") - .arg(tbt.toString(), message); + QString error_message = QString("Une erreur s'est produite avec le modèle %1 : %2").arg(tbt.toString()).arg(message); QET::QetMessageBox::critical( parent_widget_, tr("Erreur", "message box title"), error_message, QMessageBox::Ok, - QMessageBox::Ok); + QMessageBox::Ok + ); return(QET::Ignore); } @@ -117,7 +116,7 @@ QString IntegrationMoveTitleBlockTemplatesHandler::dateString() const This name is based on the current date. */ QString IntegrationMoveTitleBlockTemplatesHandler::newNameForTemplate(const TitleBlockTemplateLocation &tbt) { - return (QString("%1-%2.elmt").arg(tbt.name(), dateString())); + return(QString("%1-%2.elmt").arg(tbt.name()).arg(dateString())); } /** diff --git a/sources/titleblock/qettemplateeditor.cpp b/sources/titleblock/qettemplateeditor.cpp index 1689d89d8..d270567cd 100644 --- a/sources/titleblock/qettemplateeditor.cpp +++ b/sources/titleblock/qettemplateeditor.cpp @@ -620,11 +620,12 @@ QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const if (read_only_) { tag = tr("[Lecture seule]", "window title tag"); } - titleblock_title = - QString(tr("%1 %2", - "part of the window title - %1 is the filepath or " - "template name, %2 is the [Changed] or [Read only] tag")) - .arg(titleblock_title, tag); + titleblock_title = QString( + tr( + "%1 %2", + "part of the window title - %1 is the filepath or template name, %2 is the [Changed] or [Read only] tag" + ) + ).arg(titleblock_title).arg(tag); } return(titleblock_title); @@ -724,10 +725,12 @@ void QETTitleBlockTemplateEditor::updateEditorTitle() if (titleblock_title.isEmpty()) { title = min_title; } else { - title = QString(tr("%1 - %2", - "window title: %1 is the base window title, %2 is a " - "template name")) - .arg(min_title, titleblock_title); + title = QString( + tr( + "%1 - %2", + "window title: %1 is the base window title, %2 is a template name" + ) + ).arg(min_title).arg(titleblock_title); } setWindowTitle(title); } diff --git a/sources/titleblock/templatescollection.cpp b/sources/titleblock/templatescollection.cpp index 11f7f9c9a..b2b0ae40c 100644 --- a/sources/titleblock/templatescollection.cpp +++ b/sources/titleblock/templatescollection.cpp @@ -557,7 +557,7 @@ QString TitleBlockTemplatesFilesCollection::toTemplateName(const QString &file_n @return the file name for \a template_name */ QString TitleBlockTemplatesFilesCollection::toFileName(const QString &template_name) { - return (QString("%1%2").arg(template_name, TITLEBLOCKS_FILE_EXTENSION)); + return(QString("%1%2").arg(template_name).arg(TITLEBLOCKS_FILE_EXTENSION)); } /** diff --git a/sources/titleblock/templateview.cpp b/sources/titleblock/templateview.cpp index 9c20aa2b0..d755eca4a 100644 --- a/sources/titleblock/templateview.cpp +++ b/sources/titleblock/templateview.cpp @@ -1150,10 +1150,11 @@ TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems QString TitleBlockTemplateView::makePrettyToolTip(const QString &string) { QString css_style = QString("white-space: pre;"); - QString final_tooltip_content = - QString("
%2
").arg(css_style, string); + QString final_tooltip_content = QString( + "
%2
" + ).arg(css_style).arg(string); - return (final_tooltip_content); + return(final_tooltip_content); } /** diff --git a/sources/titleblocktemplate.cpp b/sources/titleblocktemplate.cpp index 6ec46d738..b889e1e49 100644 --- a/sources/titleblocktemplate.cpp +++ b/sources/titleblocktemplate.cpp @@ -1717,12 +1717,10 @@ QString TitleBlockTemplate::finalTextForCell( if (cell.display_label && !cell.label.isEmpty()) { cell_label = interpreteVariables(cell_label, diagram_context); - cell_text = QString(tr(" %1 : %2", - "titleblock content - please let the blank " - "space at the beginning")) - .arg(cell_label, cell_text); + cell_text = QString(tr(" %1 : %2", "titleblock content - please let the blank space at the beginning")).arg(cell_label).arg(cell_text); + } else { + cell_text = QString(tr(" %1")).arg(cell_text); } - else { cell_text = QString(tr(" %1")).arg(cell_text); } return(cell_text); } diff --git a/sources/ui/aboutqetdialog.cpp b/sources/ui/aboutqetdialog.cpp index 21f7346bf..f94b62449 100644 --- a/sources/ui/aboutqetdialog.cpp +++ b/sources/ui/aboutqetdialog.cpp @@ -236,7 +236,7 @@ void AboutQETDialog::addAuthor(QLabel *label, const QString &name, const QString QString author_template = "%1 : %2 <%3>‎

"; // Add the function of the person - new_text += author_template.arg(work, name, email); + new_text += author_template.arg(work).arg(name).arg(email); label->setText(new_text); } @@ -253,7 +253,7 @@ void AboutQETDialog::addLibrary(QLabel *label, const QString &name, const QStrin QString Library_template = "%1 : <%3>‎

"; // Add the function of the person - new_text += Library_template.arg(name, link); + new_text += Library_template.arg(name).arg(link); label->setText(new_text); } diff --git a/sources/ui/diagramcontextwidget.cpp b/sources/ui/diagramcontextwidget.cpp index 0b9b25b0d..169ca2882 100644 --- a/sources/ui/diagramcontextwidget.cpp +++ b/sources/ui/diagramcontextwidget.cpp @@ -71,7 +71,7 @@ void DiagramContextWidget::setContext (const DiagramContext &context) clear(); int i = 0; - for (const QString& key : context.keys(DiagramContext::Alphabetical)) + for (QString key : context.keys(DiagramContext::Alphabetical)) { ui->m_table->setItem(i, 0, new QTableWidgetItem(key)); ui->m_table->setItem(i, 1, new QTableWidgetItem(context[key].toString())); diff --git a/sources/ui/dynamicelementtextitemeditor.cpp b/sources/ui/dynamicelementtextitemeditor.cpp index c73fc89d7..4b3a10a7a 100644 --- a/sources/ui/dynamicelementtextitemeditor.cpp +++ b/sources/ui/dynamicelementtextitemeditor.cpp @@ -79,23 +79,23 @@ void DynamicElementTextItemEditor::apply() deti_list << m_element.data()->dynamicTextItems(); for(ElementTextItemGroup *group : m_element.data()->textGroups()) deti_list << group->texts(); + + for (DynamicElementTextItem *deti : deti_list) + { + QUndoCommand *undo = m_model->undoForEditedText(deti); - for (DynamicElementTextItem* deti : std::as_const(deti_list)) + if (undo->childCount() == 1) { - QUndoCommand* undo = m_model->undoForEditedText(deti); - - if (undo->childCount() == 1) - { - QPropertyUndoCommand* quc = new QPropertyUndoCommand( - static_cast(undo->child(0))); - if (quc->text().isEmpty()) quc->setText(undo->text()); - undo_list << quc; - delete undo; - } - else if (undo->childCount() > 1) - undo_list << undo; - else - delete undo; + QPropertyUndoCommand *quc = new QPropertyUndoCommand(static_cast(undo->child(0))); + if (quc->text().isEmpty()) + quc->setText(undo->text()); + undo_list << quc; + delete undo; + } + else if(undo->childCount() > 1) + undo_list << undo; + else + delete undo; } //Get all texts groups of the edited element @@ -127,7 +127,8 @@ void DynamicElementTextItemEditor::apply() { QUndoStack &us = m_element->diagram()->undoStack(); us.beginMacro(tr("Modifier des textes d'élément")); - for (QUndoCommand* quc : std::as_const(undo_list)) us.push(quc); + for (QUndoCommand *quc : undo_list) + us.push(quc); us.endMacro(); } } diff --git a/sources/ui/dynamicelementtextmodel.cpp b/sources/ui/dynamicelementtextmodel.cpp index a9bff7134..c3c85ea04 100644 --- a/sources/ui/dynamicelementtextmodel.cpp +++ b/sources/ui/dynamicelementtextmodel.cpp @@ -1936,8 +1936,8 @@ QStringList DynamicTextItemDelegate::availableInfo( QStringList info_list = QETInformation::elementInfoKeys(); info_list.removeAll("formula"); //No need to have formula DiagramContext dc = elmt->elementInformations(); - - for (const QString& info : std::as_const(info_list)) + + for(const QString& info : info_list) { if(dc.contains(info)) qstrl << info; diff --git a/sources/ui/elementinfowidget.cpp b/sources/ui/elementinfowidget.cpp index aab46ea82..951623070 100644 --- a/sources/ui/elementinfowidget.cpp +++ b/sources/ui/elementinfowidget.cpp @@ -158,7 +158,7 @@ bool ElementInfoWidget::event(QEvent *event) */ void ElementInfoWidget::enableLiveEdit() { - for (ElementInfoPartWidget* eipw : std::as_const(m_eipw_list)) + for (ElementInfoPartWidget *eipw : m_eipw_list) connect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply); } @@ -168,7 +168,7 @@ void ElementInfoWidget::enableLiveEdit() */ void ElementInfoWidget::disableLiveEdit() { - for (ElementInfoPartWidget* eipw : std::as_const(m_eipw_list)) + for (ElementInfoPartWidget *eipw : m_eipw_list) disconnect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply); } @@ -185,14 +185,11 @@ void ElementInfoWidget::buildInterface() keys = QETInformation::elementInfoKeys(); } - for (const auto& str : std::as_const(keys)) - { - ElementInfoPartWidget* eipw = new ElementInfoPartWidget( - str, - QETInformation::translatedInfoKey(str), - this); - ui->scroll_vlayout->addWidget(eipw); - m_eipw_list << eipw; + for (auto str : keys) + { + ElementInfoPartWidget *eipw = new ElementInfoPartWidget(str, QETInformation::translatedInfoKey(str), this); + ui->scroll_vlayout->addWidget(eipw); + m_eipw_list << eipw; } ui->scroll_vlayout->addStretch(); @@ -230,9 +227,8 @@ void ElementInfoWidget::updateUi() if (m_live_edit) disableLiveEdit(); const auto element_info{m_element->elementInformations()}; - - for (ElementInfoPartWidget* eipw : std::as_const(m_eipw_list)) - { + + for (ElementInfoPartWidget *eipw : m_eipw_list) { eipw -> setText (element_info[eipw->key()].toString()); } diff --git a/sources/ui/elementpropertieswidget.cpp b/sources/ui/elementpropertieswidget.cpp index ebd792476..e93e8e914 100644 --- a/sources/ui/elementpropertieswidget.cpp +++ b/sources/ui/elementpropertieswidget.cpp @@ -140,8 +140,7 @@ void ElementPropertiesWidget::setDynamicText(DynamicElementTextItem *text) if(text->parentElement()) { setElement(text->parentElement()); - for (AbstractElementPropertiesEditorWidget* aepew : - std::as_const(m_list_editor)) + for(AbstractElementPropertiesEditorWidget *aepew : m_list_editor) { if (QString(aepew->metaObject()->className()) == "DynamicElementTextItemEditor") { @@ -167,8 +166,7 @@ void ElementPropertiesWidget::setTextsGroup(ElementTextItemGroup *group) if(group->parentItem() && group->parentItem()->type() == Element::Type) { setElement(static_cast(group->parentItem())); - for (AbstractElementPropertiesEditorWidget* aepew : - std::as_const(m_list_editor)) + for(AbstractElementPropertiesEditorWidget *aepew : m_list_editor) { if (QString(aepew->metaObject()->className()) == "DynamicElementTextItemEditor") { @@ -316,8 +314,7 @@ void ElementPropertiesWidget::updateUi() m_list_editor << new DynamicElementTextItemEditor(m_element, this); //Add each editors in tab widget - for (AbstractElementPropertiesEditorWidget* aepew : - std::as_const(m_list_editor)) + for (AbstractElementPropertiesEditorWidget *aepew : m_list_editor) { aepew->setLiveEdit(m_live_edit); m_tab->addTab(aepew, aepew->title()); diff --git a/sources/ui/inditextpropertieswidget.cpp b/sources/ui/inditextpropertieswidget.cpp index 2b049e956..7edfe0b53 100644 --- a/sources/ui/inditextpropertieswidget.cpp +++ b/sources/ui/inditextpropertieswidget.cpp @@ -71,8 +71,7 @@ IndiTextPropertiesWidget::~IndiTextPropertiesWidget() void IndiTextPropertiesWidget::setText(IndependentTextItem *text) { if (m_text) { - for (const QMetaObject::Connection& c : std::as_const(m_connect_list)) - { + for (QMetaObject::Connection c : m_connect_list) { disconnect(c); } } @@ -90,8 +89,7 @@ void IndiTextPropertiesWidget::setText(IndependentTextItem *text) void IndiTextPropertiesWidget::setText(QList text_list) { - for (const QMetaObject::Connection& c : std::as_const(m_connect_list)) - { + for (QMetaObject::Connection c : m_connect_list) { disconnect(c); } m_connect_list.clear(); @@ -127,9 +125,7 @@ void IndiTextPropertiesWidget::apply() if (m_text && m_text->diagram()) { d = m_text->diagram(); } else if (!m_text_list.isEmpty()) { - for (const QPointer& piti : - std::as_const(m_text_list)) - { + for (QPointer piti : m_text_list) { if (piti->diagram()) { d = piti->diagram(); break; @@ -162,9 +158,7 @@ bool IndiTextPropertiesWidget::setLiveEdit(bool live_edit) setUpEditConnection(); } else { - for (const QMetaObject::Connection& c : - std::as_const(m_edit_connection)) - { + for (QMetaObject::Connection c : m_edit_connection) { disconnect(c); } m_edit_connection.clear(); @@ -226,7 +220,7 @@ QUndoCommand *IndiTextPropertiesWidget::associatedUndo() const qreal rotation_ = m_text_list.first()->rotation(); int size_ = m_text_list.first()->font().pointSize(); QFont font_ = m_text_list.first()->font(); - for (const QPointer& piti : m_text_list) + for (QPointer piti : m_text_list) { if (piti->rotation() != rotation_) { angle_equal = false; @@ -242,7 +236,7 @@ QUndoCommand *IndiTextPropertiesWidget::associatedUndo() const if ((angle_equal && (ui->m_angle_sb->value() != rotation_)) || (!angle_equal && (ui->m_angle_sb->value() != ui->m_angle_sb->minimum()))) { - for (const QPointer& piti : m_text_list) + for (QPointer piti : m_text_list) { if (piti) { @@ -257,7 +251,7 @@ QUndoCommand *IndiTextPropertiesWidget::associatedUndo() const else if ((size_equal && (ui->m_size_sb->value() != size_)) || (!size_equal && (ui->m_size_sb->value() != ui->m_size_sb->minimum()))) { - for (const QPointer& piti : m_text_list) + for (QPointer piti : m_text_list) { if (piti) { @@ -273,7 +267,7 @@ QUndoCommand *IndiTextPropertiesWidget::associatedUndo() const else if ((m_font_is_selected && !font_equal) || (m_font_is_selected && (font_equal && (m_selected_font != font_)))) { - for (const QPointer& piti : m_text_list) + for (QPointer piti : m_text_list) { if (piti) { @@ -330,8 +324,7 @@ QUndoCommand *IndiTextPropertiesWidget::associatedUndo() const */ void IndiTextPropertiesWidget::setUpEditConnection() { - for (const QMetaObject::Connection& c : std::as_const(m_edit_connection)) - { + for (QMetaObject::Connection c : m_edit_connection) { disconnect(c); } m_edit_connection.clear(); @@ -361,8 +354,7 @@ void IndiTextPropertiesWidget::updateUi() //Disconnect every connections of editor widgets //to avoid an unwanted edition (QSpinBox emit valueChanged no matter if changer by user or by program) - for (const QMetaObject::Connection& c : std::as_const(m_edit_connection)) - { + for (QMetaObject::Connection c : m_edit_connection) { disconnect(c); } m_edit_connection.clear(); @@ -396,8 +388,7 @@ void IndiTextPropertiesWidget::updateUi() int size_ = m_text_list.first()->font().pointSize(); QFont font_ = m_text_list.first()->font(); - for (const QPointer& piti : - std::as_const(m_text_list)) + for (QPointer piti : m_text_list) { if (piti->rotation() != rotation_) { angle_equal = false; @@ -412,9 +403,7 @@ void IndiTextPropertiesWidget::updateUi() ui->m_angle_sb->setValue(angle_equal ? rotation_ : 0); bool valid_ = true; - for (const QPointer& piti : - std::as_const(m_text_list)) - { + for (QPointer piti : m_text_list) { if (piti->isHtml()) { valid_ = false; } @@ -447,11 +436,10 @@ void IndiTextPropertiesWidget::on_m_break_html_pb_clicked() if (m_text) { m_text->setPlainText(m_text->toPlainText()); } - for (const QPointer& piti : std::as_const(m_text_list)) - { + for (QPointer piti : m_text_list) { piti->setPlainText(piti->toPlainText()); } - + updateUi(); } diff --git a/sources/ui/multipastedialog.cpp b/sources/ui/multipastedialog.cpp index afa981a89..321f36a84 100644 --- a/sources/ui/multipastedialog.cpp +++ b/sources/ui/multipastedialog.cpp @@ -117,7 +117,7 @@ void MultiPasteDialog::on_m_button_box_accepted() m_diagram->clearSelection(); m_diagram->undoStack().push(new PasteDiagramCommand(m_diagram, m_pasted_content)); - for (const DiagramContent& dc : std::as_const(m_pasted_content_list)) + for(DiagramContent dc : m_pasted_content_list) { QList pasted_elements = dc.m_elements; //Sort the list element by there pos (top -> bottom) diff --git a/sources/ui/potentialselectordialog.cpp b/sources/ui/potentialselectordialog.cpp index f3461e124..353bf7168 100644 --- a/sources/ui/potentialselectordialog.cpp +++ b/sources/ui/potentialselectordialog.cpp @@ -204,7 +204,7 @@ ConductorProperties PotentialSelectorDialog::chosenProperties(QList H; - for (const ConductorProperties& cp : list) + for (ConductorProperties cp : list) { QString text; if(!cp.text.isEmpty()) diff --git a/sources/ui/shapegraphicsitempropertieswidget.cpp b/sources/ui/shapegraphicsitempropertieswidget.cpp index 521abe577..2eb9eb8e0 100644 --- a/sources/ui/shapegraphicsitempropertieswidget.cpp +++ b/sources/ui/shapegraphicsitempropertieswidget.cpp @@ -121,7 +121,7 @@ void ShapeGraphicsItemPropertiesWidget::apply() } else if (!m_shapes_list.isEmpty()) { - for (const QPointer& qsi : std::as_const(m_shapes_list)) + for (QPointer qsi : m_shapes_list) { if (qsi->diagram()) { d = qsi->diagram(); @@ -222,7 +222,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const if (ui->m_style_cb->currentIndex() != -1 && Qt::PenStyle(ui->m_style_cb->currentIndex() + 1) != shape_->pen().style()) { - for (const QPointer& qsi : m_shapes_list) + for (QPointer qsi : m_shapes_list) { QPen pen = qsi->pen(); @@ -239,7 +239,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const if (ui->m_size_dsb->value() > 0 && ui->m_size_dsb->value() != shape_->pen().widthF()) { - for (const QPointer& qsi : m_shapes_list) + for (QPointer qsi : m_shapes_list) { QPen pen = pen_H.contains(qsi) ? pen_H.value(qsi) : qsi->pen(); pen.setWidthF(ui->m_size_dsb->value()); @@ -250,7 +250,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const QColor c =ui->m_color_kpb->color(); if (c != QPalette().color(QPalette::Button) && shape_->pen().color() != c) { - for (const QPointer& qsi : m_shapes_list) + for (QPointer qsi : m_shapes_list) { QPen pen = pen_H.contains(qsi) ? pen_H.value(qsi) : qsi->pen(); pen.setColor(c); @@ -258,7 +258,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const } } - for (const QPointer& qsi : pen_H.keys()) + for (QPointer qsi : pen_H.keys()) { if (!parent_undo) { parent_undo = new QUndoCommand(tr("Modifier une forme simple")); @@ -271,7 +271,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const if (ui->m_brush_style_cb->currentIndex() != -1 && shape_->brush().style() != Qt::BrushStyle(ui->m_brush_style_cb->currentIndex())) { - for (const QPointer& qsi : m_shapes_list) + for (QPointer qsi : m_shapes_list) { QBrush brush = qsi->brush(); brush.setStyle(Qt::BrushStyle(ui->m_brush_style_cb->currentIndex())); @@ -282,7 +282,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const c = ui->m_brush_color_kpb->color(); if (c != QPalette().color(QPalette::Button) && shape_->brush().color() != c) { - for (const QPointer& qsi : m_shapes_list) + for (QPointer qsi : m_shapes_list) { QBrush brush = brush_H.contains(qsi) ? brush_H.value(qsi) : qsi->brush(); brush.setColor(c); @@ -290,7 +290,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const } } - for (const QPointer& qsi : brush_H.keys()) + for (QPointer qsi : brush_H.keys()) { if (!parent_undo) { parent_undo = new QUndoCommand(tr("Modifier une forme simple")); @@ -383,8 +383,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi() bool same = true; //Pen Qt::PenStyle ps = m_shapes_list.first()->pen().style(); - for (QetShapeItem* qsi : std::as_const(m_shapes_list)) - { + for (QetShapeItem *qsi : m_shapes_list) { if (qsi->pen().style() != ps) { same = false; break; @@ -394,8 +393,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi() same = true; qreal pw = m_shapes_list.first()->pen().widthF(); - for (QetShapeItem* qsi : std::as_const(m_shapes_list)) - { + for (QetShapeItem *qsi : m_shapes_list) { if (qsi->pen().widthF() != pw) { same = false; break; @@ -405,8 +403,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi() same = true; QColor pc = m_shapes_list.first()->pen().color(); - for (QetShapeItem* qsi : std::as_const(m_shapes_list)) - { + for (QetShapeItem *qsi : m_shapes_list) { if (qsi->pen().color() != pc) { same = false; break; @@ -419,8 +416,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi() same = true; Qt::BrushStyle bs = m_shapes_list.first()->brush().style(); - for (QetShapeItem* qsi : std::as_const(m_shapes_list)) - { + for (QetShapeItem *qsi : m_shapes_list) { if (qsi->brush().style() != bs) { same = false; break; @@ -430,8 +426,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi() same = true; QColor bc = m_shapes_list.first()->brush().color(); - for (QetShapeItem* qsi : std::as_const(m_shapes_list)) - { + for (QetShapeItem *qsi : m_shapes_list) { if (qsi->brush().color() != bc) { same = false; break; @@ -521,8 +516,7 @@ void ShapeGraphicsItemPropertiesWidget::on_m_lock_pos_cb_clicked() m_shape->setMovable(!ui->m_lock_pos_cb->isChecked()); } else if (!m_shapes_list.isEmpty()) { - for (const QPointer& qsi : std::as_const(m_shapes_list)) - { + for (QPointer qsi : m_shapes_list) { qsi->setMovable(!ui->m_lock_pos_cb->isChecked()); } } diff --git a/sources/undocommand/addelementtextcommand.cpp b/sources/undocommand/addelementtextcommand.cpp index cd20c0133..4e97f6ad1 100644 --- a/sources/undocommand/addelementtextcommand.cpp +++ b/sources/undocommand/addelementtextcommand.cpp @@ -184,7 +184,7 @@ void AddTextsGroupCommand::redo() } else { - for (DynamicElementTextItem* deti : std::as_const(m_deti_list)) + for(DynamicElementTextItem *deti : m_deti_list) m_element.data()->addTextToGroup( deti, m_group.data()); @@ -194,7 +194,7 @@ void AddTextsGroupCommand::redo() else if(m_group) { m_element.data()->addTextGroup(m_group.data()); - for (DynamicElementTextItem* deti : std::as_const(m_deti_list)) + for(DynamicElementTextItem *deti : m_deti_list) m_element.data()->addTextToGroup(deti, m_group.data()); } } @@ -236,9 +236,8 @@ void RemoveTextsGroupCommand::undo() if(m_element && m_group) { m_element.data()->addTextGroup(m_group.data()); - - for (const QPointer& p : - std::as_const(m_text_list)) + + for(const QPointer& p : m_text_list) if(p) m_element.data()->addTextToGroup( p.data(), @@ -253,8 +252,7 @@ void RemoveTextsGroupCommand::redo() { if(m_element && m_group) { - for (const QPointer& p : - std::as_const(m_text_list)) + for(const QPointer& p : m_text_list) if(p) m_element.data()->removeTextFromGroup( p.data(), diff --git a/sources/undocommand/changeelementinformationcommand.cpp b/sources/undocommand/changeelementinformationcommand.cpp index c6eb839e6..728369a31 100644 --- a/sources/undocommand/changeelementinformationcommand.cpp +++ b/sources/undocommand/changeelementinformationcommand.cpp @@ -60,8 +60,7 @@ bool ChangeElementInformationCommand::mergeWith(const QUndoCommand *other) //In case of other undo_undo have the same elements as keys if (m_map.size() == other_undo->m_map.size()) { - for (const auto& key : other_undo->m_map.keys()) - { + for (auto key : other_undo->m_map.keys()) { if (!m_map.keys().contains(key)) { return false; } @@ -70,13 +69,12 @@ bool ChangeElementInformationCommand::mergeWith(const QUndoCommand *other) //Other_undo will be merged with this undo : //Replace the new_info values of this m_map //by the new_info values of other_undo's m_map - for (const auto& key : other_undo->m_map.keys()) - { - m_map.insert( - key, - qMakePair( - m_map.value(key).first, - other_undo->m_map.value(key).second)); + for (auto key : other_undo->m_map.keys()) + { + m_map.insert(key, + qMakePair( + m_map.value(key).first, + other_undo->m_map.value(key).second)); } return true; } @@ -115,7 +113,8 @@ void ChangeElementInformationCommand::updateProjectDB() //need to have a list of element instead of QPointer //for the function elementInfoChange of the database QList list_; - for (const auto& p_elmt : m_map.keys()) list_ << p_elmt.data(); + for (auto p_elmt : m_map.keys()) + list_ << p_elmt.data(); elmt->diagram()->project()->dataBase()->elementInfoChanged(list_); } diff --git a/sources/undocommand/deleteqgraphicsitemcommand.cpp b/sources/undocommand/deleteqgraphicsitemcommand.cpp index 977f63ba3..5aa85ca42 100644 --- a/sources/undocommand/deleteqgraphicsitemcommand.cpp +++ b/sources/undocommand/deleteqgraphicsitemcommand.cpp @@ -55,8 +55,7 @@ DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand( //When removing a deti we must know its parent item, for re-adding deti as child of the parent //when undoing this command - for (DynamicElementTextItem* deti : - std::as_const(m_removed_contents.m_element_texts)) + for(DynamicElementTextItem *deti : m_removed_contents.m_element_texts) { if(deti->parentGroup()) m_grp_texts_hash.insert(deti, deti->parentGroup()); @@ -74,9 +73,7 @@ DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand( } //The deletion of the groups is not managed by this undo, but by a RemoveTextsGroupCommand - for (ElementTextItemGroup* group : - std::as_const(m_removed_contents.m_texts_groups)) - { + for(ElementTextItemGroup *group : m_removed_contents.m_texts_groups) { new RemoveTextsGroupCommand(group->parentElement(), group, this); } @@ -84,7 +81,7 @@ DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand( setPotentialsOfRemovedElements(); //Get all linkeds table of removed table. - for (auto table : std::as_const(m_removed_contents.m_tables)) + for (auto table : m_removed_contents.m_tables) { //Table is already managed, jump to next loop if (m_table_scene_hash.keys().contains(table)) @@ -125,7 +122,7 @@ DeleteQGraphicsItemCommand::~DeleteQGraphicsItemCommand() */ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements() { - for (Element* elmt : std::as_const(m_removed_contents.m_elements)) + for (Element *elmt : m_removed_contents.m_elements) { //a list of terminals who have at least two conductors docked in. QList terminals_list; @@ -182,8 +179,7 @@ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements() //If a conductor was already created between these two terminals //in this undo command, from another removed element, we do nothing bool exist_ = false; - for (QPair pair : - std::as_const(m_connected_terminals)) + for (QPair pair : m_connected_terminals) { if (pair.first == hub_terminal && pair.second == t) { exist_ = true; @@ -230,7 +226,7 @@ Terminal *DeleteQGraphicsItemCommand::terminalInSamePotential( { QList conductor_list = terminal->conductors(); conductor_list.removeAll(conductor_to_exclude); - for (Conductor* c : std::as_const(conductor_list)) + for(Conductor *c : conductor_list) { Terminal *other_terminal = c->terminal1 == terminal ? c->terminal2 : c->terminal1; if(!m_removed_contents.items(DiagramContent::Elements).contains(other_terminal->parentElement())) { @@ -238,7 +234,7 @@ Terminal *DeleteQGraphicsItemCommand::terminalInSamePotential( } } //No one of direct conductor of terminal are docked to an element which is not removed - for (Conductor* c : std::as_const(conductor_list)) + for(Conductor *c : conductor_list) { Terminal *other_terminal = c->terminal1 == terminal ? c->terminal2 : c->terminal1; Terminal *terminal_to_return = terminalInSamePotential(other_terminal, c); @@ -262,12 +258,11 @@ void DeleteQGraphicsItemCommand::undo() m_diagram->addItem(item); //We relink element after every element was added to diagram - for (Element* e : std::as_const(m_removed_contents.m_elements)) + for(Element *e : m_removed_contents.m_elements) for(Element *elmt : m_link_hash[e]) e->linkToElement(elmt); - for (DynamicElementTextItem* deti : - std::as_const(m_removed_contents.m_element_texts)) + for(DynamicElementTextItem *deti : m_removed_contents.m_element_texts) { if(m_elmt_text_hash.keys().contains(deti)) m_elmt_text_hash.value(deti)->addDynamicTextItem(deti); @@ -312,15 +307,14 @@ void DeleteQGraphicsItemCommand::redo() } } - for (Element* e : std::as_const(m_removed_contents.m_elements)) + for(Element *e : m_removed_contents.m_elements) { //Get linked element, for relink it at undo if (!e->linkedElements().isEmpty()) m_link_hash.insert(e, e->linkedElements()); } - for (DynamicElementTextItem* deti : - std::as_const(m_removed_contents.m_element_texts)) + for(DynamicElementTextItem *deti : m_removed_contents.m_element_texts) { if(deti->parentGroup() && deti->parentGroup()->parentElement()) deti->parentGroup()->parentElement()->removeTextFromGroup(deti, deti->parentGroup()); diff --git a/sources/undocommand/linkelementcommand.cpp b/sources/undocommand/linkelementcommand.cpp index c3a9afe62..c5e3d82a4 100644 --- a/sources/undocommand/linkelementcommand.cpp +++ b/sources/undocommand/linkelementcommand.cpp @@ -203,7 +203,7 @@ void LinkElementCommand::redo() QStringList str_txt; QStringList str_funct; QStringList str_tens; - for (const Conductor* c : std::as_const(c_list)) + for (const Conductor *c : c_list) { str_txt << c->properties().text; str_funct << c->properties().m_function; diff --git a/sources/undocommand/rotateselectioncommand.cpp b/sources/undocommand/rotateselectioncommand.cpp index 60fb74e1f..bac35b594 100644 --- a/sources/undocommand/rotateselectioncommand.cpp +++ b/sources/undocommand/rotateselectioncommand.cpp @@ -74,8 +74,8 @@ m_diagram(diagram) break; } } - - for (QPropertyUndoCommand* undo : std::as_const(m_undo)) + + for (QPropertyUndoCommand *undo : m_undo) undo->setAnimated(true, false); } } @@ -87,8 +87,8 @@ void RotateSelectionCommand::undo() { m_diagram->showMe(); QUndoCommand::undo(); - - for (const QPointer& cti : std::as_const(m_cond_text)) + + for(const QPointer& cti : m_cond_text) { cti->forceRotateByUser(m_rotate_by_user.value(cti.data())); if(!cti->wasRotateByUser()) @@ -103,11 +103,11 @@ void RotateSelectionCommand::redo() { m_diagram->showMe(); QUndoCommand::redo(); - - for (const QPointer& cti : std::as_const(m_cond_text)) - { - m_rotate_by_user.insert(cti, cti->wasRotateByUser()); - cti->forceRotateByUser(true); + + for(const QPointer& cti : m_cond_text) + { + m_rotate_by_user.insert(cti, cti->wasRotateByUser()); + cti->forceRotateByUser(true); } } diff --git a/sources/undocommand/rotatetextscommand.cpp b/sources/undocommand/rotatetextscommand.cpp index 070a4d795..c06a4f35c 100644 --- a/sources/undocommand/rotatetextscommand.cpp +++ b/sources/undocommand/rotatetextscommand.cpp @@ -69,10 +69,10 @@ m_diagram(diagram) } if(!text.isNull()) setText(text); - - for (DiagramTextItem* dti : std::as_const(texts_list)) + + for(DiagramTextItem *dti : texts_list) setupAnimation(dti, "rotation", dti->rotation(), m_rotation); - for (ElementTextItemGroup* grp : std::as_const(groups_list)) + for(ElementTextItemGroup *grp : groups_list) setupAnimation(grp, "rotation", grp->rotation(), m_rotation); } else diff --git a/sources/utils/conductorcreator.cpp b/sources/utils/conductorcreator.cpp index 774a6804b..2bacc1f4f 100644 --- a/sources/utils/conductorcreator.cpp +++ b/sources/utils/conductorcreator.cpp @@ -49,7 +49,7 @@ ConductorCreator::ConductorCreator(Diagram *d, QList terminals_list) d->undoStack().beginMacro(QObject::tr("Création de conducteurs")); QList c_list; - for (Terminal* t : std::as_const(m_terminals_list)) + for (Terminal *t : m_terminals_list) { if (t == hub_terminal) { continue; @@ -108,14 +108,12 @@ void ConductorCreator::setUpPropertieToUse() if (potentials.size() >= 2) { QList cp_list; - for (Conductor* c : std::as_const(potentials)) - { + for(Conductor *c : potentials) { cp_list.append(c->properties()); } - + m_properties = PotentialSelectorDialog::chosenProperties(cp_list); - for (Conductor* c : std::as_const(potentials)) - { + for (Conductor *c : potentials) { if (c->properties() == m_properties) { m_sequential_number = c->sequenceNum(); } @@ -143,8 +141,8 @@ QList ConductorCreator::existingPotential() { QList c_list; QList t_exclude; - - for (Terminal* t : std::as_const(m_terminals_list)) + + for (Terminal *t : m_terminals_list) { if (t_exclude.contains(t)) { continue; @@ -184,8 +182,8 @@ QList ConductorCreator::existingPotential() Terminal *ConductorCreator::hubTerminal() { Terminal *hub_terminal = m_terminals_list.first(); - - for (Terminal* tt : std::as_const(m_terminals_list)) + + for (Terminal *tt : m_terminals_list) { if (tt->scenePos().x() < hub_terminal->scenePos().x()) { hub_terminal = tt;