ComboBox change sorting

alphabetical sorting in the ComboBox changed according to the order in
the elementInfoKeys list
This commit is contained in:
Achim
2024-12-31 08:40:03 +01:00
parent 8e0c3f4252
commit e73aa3b84d
3 changed files with 10 additions and 26 deletions

View File

@@ -68,15 +68,9 @@ void CompositeTextEditDialog::setUpComboBox()
qstrl.removeAll("formula");
}
//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 <QString, QString> 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));
for (int i=0; i<qstrl.size();++i) {
ui -> m_info_cb -> addItem(QETInformation::translatedInfoKey(qstrl[i]),
is_report ? QETInformation::folioReportInfoToVar(qstrl[i]) : QETInformation::elementInfoToVar(qstrl[i]));
}
}