mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
LC: Use section name in combo box.
This commit is contained in:
1 parent
dc490cef44
commit
2b31426df3
1 file changed
+18
-2
@@ -94,7 +94,10 @@ class ComboBoxDelegate(QItemDelegate):
|
|||||||
else:
|
else:
|
||||||
self.editor.addItems(
|
self.editor.addItems(
|
||||||
list(
|
list(
|
||||||
map(str, self._data.reach.get_rk())
|
map(
|
||||||
|
lambda p: p.display_name(),
|
||||||
|
self._data.reach.profiles
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@@ -112,7 +115,20 @@ class ComboBoxDelegate(QItemDelegate):
|
|||||||
|
|
||||||
def setModelData(self, editor, model, index):
|
def setModelData(self, editor, model, index):
|
||||||
text = str(editor.currentText())
|
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.close()
|
||||||
editor.deleteLater()
|
editor.deleteLater()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user