diff --git a/src/Gui/PreferencePages/DlgSettingsEditor.cpp b/src/Gui/PreferencePages/DlgSettingsEditor.cpp index a8a4bb35a8..65b44ced5f 100644 --- a/src/Gui/PreferencePages/DlgSettingsEditor.cpp +++ b/src/Gui/PreferencePages/DlgSettingsEditor.cpp @@ -163,9 +163,10 @@ DlgSettingsEditor::DlgSettingsEditor( QWidget* parent ) QStringList labels; labels << tr("Items"); ui->displayItems->setHeaderLabels(labels); ui->displayItems->header()->hide(); - for (QVector >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it) { + for (const auto &[textType, textColor]: d->colormap) + { auto item = new QTreeWidgetItem(ui->displayItems); - item->setText(0, tr((*it).first.toLatin1())); + item->setText(0, tr(textType.toLatin1())); } pythonSyntax = new PythonSyntaxHighlighter(ui->textEdit1); pythonSyntax->setDocument(ui->textEdit1->document()); @@ -243,11 +244,11 @@ void DlgSettingsEditor::saveSettings() // Saves the color map ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Editor"); - for (QVector >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it) { - auto col = static_cast((*it).second); - hGrp->SetUnsigned((*it).first.toLatin1(), col); + for (const auto &[textType, textColor] : d->colormap) + { + auto col = static_cast(textColor); + hGrp->SetUnsigned(textType.toLatin1(), col); } - hGrp->SetInt( "FontSize", ui->fontSize->value() ); hGrp->SetASCII( "Font", ui->fontFamily->currentText().toLatin1() ); @@ -280,13 +281,13 @@ void DlgSettingsEditor::loadSettings() // Restores the color map ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Editor"); - for (QVector>::Iterator it = d->colormap.begin(); - it != d->colormap.end(); ++it) { - auto col = static_cast((*it).second); - col = hGrp->GetUnsigned((*it).first.toLatin1(), col); - (*it).second = static_cast(col); + for (auto &[textType, textColor] : d->colormap) + { + auto col = static_cast(textColor); + col = hGrp->GetUnsigned(textType.toLatin1(), col); + textColor = static_cast(col); QColor color = App::Color::fromPackedRGB(col); - pythonSyntax->setColor((*it).first, color); + pythonSyntax->setColor(textType, color); } // fill up font styles @@ -332,8 +333,9 @@ void DlgSettingsEditor::resetSettingsToDefaults() ParameterGrp::handle hGrp; hGrp = WindowParameter::getDefaultParameter()->GetGroup("Editor"); //reset the parameters in the "Editor" group - for (QVector >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it) { - hGrp->RemoveUnsigned((*it).first.toLatin1()); + for (const auto &[textType, textColor] : d->colormap) + { + hGrp->RemoveUnsigned(textType.toLatin1()); } //reset "FontSize" parameter hGrp->RemoveInt("FontSize"); @@ -351,8 +353,8 @@ void DlgSettingsEditor::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { int index = 0; - for (QVector >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it) - ui->displayItems->topLevelItem(index++)->setText(0, tr((*it).first.toLatin1())); + for (const auto &[textType, textColor]: d->colormap) + ui->displayItems->topLevelItem(index++)->setText(0, tr(textType.toLatin1())); ui->retranslateUi(this); } else { QWidget::changeEvent(e);