def createEditor(self, parent, option, index): if index.column() == COLOR: dialog = QColorDialog(parent) return dialog elif index.column() == COLORLABEL: return QLineEdit(parent) else: return QItemDelegate.createEditor(self, parent, option, index)
def createEditor(self, parent, option, index): col = index.column() if col == index.model().i_diaph: row = index.row() combobox = QComboBox(parent) diaphs = (index.model().diaphs[row]).split(',') combobox.addItems(diaphs) # combobox.setEditable(True) return combobox else: return QItemDelegate.createEditor(self, parent, option, index)
def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex) -> QWidget: """ Overriding inherited createdEditor class Args: parent: Parent widget option: Style options for the related view index: Specific index being edited Returns: """ if index.column() == TreeModelParamEntry.TYPE: node = index.model().nodeFromIndex(index) combo = node.get_type_combobox(parent) #dicts vs values #combo.setEditable(True) return combo else: return QItemDelegate.createEditor(self, parent, option, index)
def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex) -> QWidget: """ Overriding inherited createdEditor class. Note that the index contains information about the model being used. The editor's parent widget is specified by parent, and the item options by option. Args: parent: Parent widget option: Style options for the related view index: Specific index being edited Returns: Returns the editor to be used for editing the data item with the given index. """ if index.column() == TreeModelParamEntry.TYPE: node = index.model().nodeFromIndex(index) combo = node.get_type_combobox(parent) #dicts vs values return combo return QItemDelegate.createEditor(self, parent, option, index)