mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
ComboBox change sorting
alphabetical sorting in the ComboBox changed according to the order in the elementInfoKeys list
This commit is contained in:
@@ -1623,17 +1623,12 @@ QWidget *DynamicTextItemDelegate::createEditor(
|
||||
if(!deti)
|
||||
break;
|
||||
|
||||
//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 : availableInfo(deti)) {
|
||||
info_map.insert(QETInformation::translatedInfoKey(str), str);
|
||||
}
|
||||
|
||||
QComboBox *qcb = new QComboBox(parent);
|
||||
qcb->setObjectName("info_text");
|
||||
for (const QString& key : info_map.keys()) {
|
||||
qcb->addItem(key, info_map.value(key));
|
||||
|
||||
QStringList strl = availableInfo(deti);
|
||||
for (int i=0; i<strl.size();++i) {
|
||||
qcb -> addItem(QETInformation::translatedInfoKey(strl[i]), strl[i]);
|
||||
}
|
||||
return qcb;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user