def setEditorData(self, editor, index): if index.column() == sbml_entitytablemodel.REACTION_ROW.REACTANTS: text = index.model().data(index, Qt.DisplayRole).toString() i = editor.findText(text) if i == -1: i = 0 editor.setCurrentIndex(i) else: QStyledItemDelegate.setEditorData(self, editor, index)
def setEditorData(self, editor, index): # text = index.model().data(index, Qt.DisplayRole).toString() # if index.column() == TEU: # value = text.replace(QRegExp("[., ]"), "").toInt()[0] # editor.setValue(value) # elif index.column() in (OWNER, COUNTRY): # i = editor.findText(text) # if i == -1: # i = 0 # editor.setCurrentIndex(i) # elif index.column() == NAME: # editor.setText(text) # elif index.column() == DESCRIPTION: # editor.setHtml(text) if index.model().dataMode == sbml_entities.TYPE.REACTION: self.setEditorDataReaction(editor, index) else: QStyledItemDelegate.setEditorData(self, editor, index)
def setEditorData(self, editor, index): """ Sets the data to be displayed and edited by our custom editor. """ if index.column() == 3: editor.starRating = StarRating(index.data()) else: QStyledItemDelegate.setEditorData(self, editor, index)
def setEditorData(self, editor, index): """ Sets the data to be displayed and edited by our custom editor. """ if index.column() == 6: editor.starRating = StarRating(index.data()) else: QStyledItemDelegate.setEditorData(self, editor, index)