From 31ed09f185c90b3a4bc909c1fe1d83c869cbbc58 Mon Sep 17 00:00:00 2001 From: Laurent Trinques Date: Sun, 22 Dec 2024 16:17:32 +0100 Subject: [PATCH] Revert "Try to fix https://github.com/qelectrotech/qelectrotech-source-mirror/" This reverts commit 3992c60c45adfbbbecca119e1e505e9d3f0bc0d7. --- sources/editor/ui/dynamictextfieldeditor.cpp | 13 +++++-------- sources/ui/compositetexteditdialog.cpp | 13 ++++++++++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sources/editor/ui/dynamictextfieldeditor.cpp b/sources/editor/ui/dynamictextfieldeditor.cpp index 6a9816962..15c3872e3 100644 --- a/sources/editor/ui/dynamictextfieldeditor.cpp +++ b/sources/editor/ui/dynamictextfieldeditor.cpp @@ -222,7 +222,11 @@ void DynamicTextFieldEditor::fillInfoComboBox() if(type & ElementData::AllReport) { strl = QETInformation::folioReportInfoKeys(); - //We use a QMap because the keys of the map are sorted, then no matter the current local, + } + else { + strl = QETInformation::elementInfoKeys(); + } + //We use a QMap because the keys of the map are sorted, then no matter the current local, //the value of the combo box are always alphabetically sorted QMap info_map; for(const QString& str : strl) @@ -231,13 +235,6 @@ void DynamicTextFieldEditor::fillInfoComboBox() for (const QString& key : info_map.keys()) ui -> m_elmt_info_cb -> addItem(key, info_map.value(key)); - } - else { - strl = QETInformation::elementInfoKeys(); - for (int i=0; i m_elmt_info_cb -> addItem(strl[i], QETInformation::translatedInfoKey(strl[i])); - } - } } void DynamicTextFieldEditor::on_m_x_sb_editingFinished() diff --git a/sources/ui/compositetexteditdialog.cpp b/sources/ui/compositetexteditdialog.cpp index 63deb7091..045615e3d 100644 --- a/sources/ui/compositetexteditdialog.cpp +++ b/sources/ui/compositetexteditdialog.cpp @@ -67,9 +67,16 @@ void CompositeTextEditDialog::setUpComboBox() qstrl = QETInformation::elementInfoKeys(); qstrl.removeAll("formula"); } - for (int i=0; i m_info_cb -> addItem(qstrl[i], QETInformation::translatedInfoKey(qstrl[i])); - + + //We use a QMap because the keys of the map are sorted, then no matter the current local, + //the value of the combo box are always alphabetically sorted + QMap info_map; + for(const QString& str : qstrl) { + info_map.insert(QETInformation::translatedInfoKey(str), + is_report ? QETInformation::folioReportInfoToVar(str) : QETInformation::elementInfoToVar(str)); + } + for(const QString& key : info_map.keys()) { + ui->m_info_cb->addItem(key, info_map.value(key)); } }