network: Table combo box set on current value.

mesh
Pierre-Antoine Rouby 2023-03-29 16:13:06 +02:00
parent a18cb2d65f
commit 53994ea923
1 changed files with 2 additions and 0 deletions

View File

@ -25,6 +25,7 @@ class ComboBoxDelegate(QItemDelegate):
def createEditor(self, parent, option, index):
self.editor = QComboBox(parent)
self.editor.addItems(self.graph.nodes_names())
self.editor.setCurrentText(index.data(Qt.DisplayRole))
return self.editor
def setEditorData(self, editor, index):
@ -54,6 +55,7 @@ class TrueFalseComboBoxDelegate(QItemDelegate):
def createEditor(self, parent, option, index):
self.editor = QComboBox(parent)
self.editor.addItems(["true", "false"])
self.editor.setCurrentText("true" if index.data(Qt.DisplayRole) else "false")
return self.editor
def setEditorData(self, editor, index):