mirror of https://gitlab.com/pamhyr/pamhyr2
LC: Use section name in combo box.
parent
dc490cef44
commit
2b31426df3
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue