LC: Use section name in combo box.

compare_results
Pierre-Antoine Rouby 2024-10-02 14:40:43 +02:00
parent dc490cef44
commit 2b31426df3
1 changed files with 18 additions and 2 deletions

View File

@ -94,7 +94,10 @@ class ComboBoxDelegate(QItemDelegate):
else:
self.editor.addItems(
list(
map(str, self._data.reach.get_rk())
map(
lambda p: p.display_name(),
self._data.reach.profiles
)
)
)
else:
@ -112,7 +115,20 @@ class ComboBoxDelegate(QItemDelegate):
def setModelData(self, editor, model, index):
text = str(editor.currentText())
model.setData(index, text)
if self._mode == "rk":
profiles = list(
filter(
lambda p: p.display_name() == text,
self._data.reach.profiles
)
)
value = profiles[0].rk if len(profiles) > 0 else None
else:
value = text
model.setData(index, value)
editor.close()
editor.deleteLater()