def setEditorData(self, editor, index): #pylint: disable=invalid-name """Populate the combo box. Set the current index of the combo box to be the current value in the model. """ if not index.isValid(): return if not isinstance(index.model(), QSqlRelationalTableModel): # If not a QSqlRelationalTableModel, must be a proxy model. proxy_model = index.model() self.setEditorData(editor, proxy_model.mapToSource(index)) return sql_model = index.model() str_val = sql_model.data(index) combobox = None if isinstance(editor, QComboBox): combobox = editor if not str_val or not isinstance(str_val, str) or not combobox: QItemDelegate.setEditorData(self, editor, index) return combobox.setCurrentIndex(combobox.findText(str_val))
def setEditorData(self, editor, index): text = index.model().data(index, Qt.DisplayRole) if index.column() == QUALITY: i = editor.findText(text) if i == -1: i = 0 editor.setCurrentIndex(i) else: QItemDelegate.setEditorData(self, editor, index)
def setEditorData(self, editor, index): """Set Target Quality.""" text = index.model().data(index, Qt.DisplayRole) if index.column() == COLUMNS.QUALITY: i = editor.findText(text) if i == -1: i = 0 editor.setCurrentIndex(i) else: QItemDelegate.setEditorData(self, editor, index) self.parent.tb_tasks.setEditTriggers(QAbstractItemView.NoEditTriggers)
def setEditorData(self, editor, index): if isinstance(editor, QComboBox): i = editor.findText(index.data(Qt.EditRole)) if i > -1: editor.setCurrentIndex(i) else: editor.setEditText(index.data(Qt.EditRole)) editor.lineEdit().selectAll() elif isinstance(editor, QTextEdit): editor.setText(str(index.data(Qt.EditRole))) editor.selectAll() else: return QItemDelegate.setEditorData(self, editor, index)
def setEditorData(self, editor, index): if editor.text().strip(): QItemDelegate.setEditorData(self, editor, index)
def setEditorData(self, editor, index): if isinstance(editor, QComboBox): self.comboDel.setEditorData(editor, index) else: QItemDelegate.setEditorData(self, editor, index)
def setEditorData(self, editor, index): QItemDelegate.setEditorData(self, editor, index)