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:
@@ -226,15 +226,10 @@ void DynamicTextFieldEditor::fillInfoComboBox()
|
|||||||
else {
|
else {
|
||||||
strl = QETInformation::elementInfoKeys();
|
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 <QString, QString> info_map;
|
|
||||||
for(const QString& str : strl)
|
|
||||||
info_map.insert(QETInformation::translatedInfoKey(str), str);
|
|
||||||
|
|
||||||
|
for (int i=0; i<strl.size();++i) {
|
||||||
for (const QString& key : info_map.keys())
|
ui -> m_elmt_info_cb -> addItem(QETInformation::translatedInfoKey(strl[i]), strl[i]);
|
||||||
ui -> m_elmt_info_cb -> addItem(key, info_map.value(key));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicTextFieldEditor::on_m_x_sb_editingFinished()
|
void DynamicTextFieldEditor::on_m_x_sb_editingFinished()
|
||||||
|
|||||||
@@ -68,15 +68,9 @@ void CompositeTextEditDialog::setUpComboBox()
|
|||||||
qstrl.removeAll("formula");
|
qstrl.removeAll("formula");
|
||||||
}
|
}
|
||||||
|
|
||||||
//We use a QMap because the keys of the map are sorted, then no matter the current local,
|
for (int i=0; i<qstrl.size();++i) {
|
||||||
//the value of the combo box are always alphabetically sorted
|
ui -> m_info_cb -> addItem(QETInformation::translatedInfoKey(qstrl[i]),
|
||||||
QMap <QString, QString> info_map;
|
is_report ? QETInformation::folioReportInfoToVar(qstrl[i]) : QETInformation::elementInfoToVar(qstrl[i]));
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1623,17 +1623,12 @@ QWidget *DynamicTextItemDelegate::createEditor(
|
|||||||
if(!deti)
|
if(!deti)
|
||||||
break;
|
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);
|
QComboBox *qcb = new QComboBox(parent);
|
||||||
qcb->setObjectName("info_text");
|
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;
|
return qcb;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user