本文整理汇总了Python中PyQt5.QtWidgets.QStyledItemDelegate.setItemEditorFactory方法的典型用法代码示例。如果您正苦于以下问题:Python QStyledItemDelegate.setItemEditorFactory方法的具体用法?Python QStyledItemDelegate.setItemEditorFactory怎么用?Python QStyledItemDelegate.setItemEditorFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QStyledItemDelegate
的用法示例。
在下文中一共展示了QStyledItemDelegate.setItemEditorFactory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createGUI
# 需要导入模块: from PyQt5.QtWidgets import QStyledItemDelegate [as 别名]
# 或者: from PyQt5.QtWidgets.QStyledItemDelegate import setItemEditorFactory [as 别名]
def createGUI(self):
colorEditorFactory = QItemEditorFactory()
colorEditorFactory.registerEditor(QVariant.Color, ColorListItemEditorCreator())
colorEditorDelegate = QStyledItemDelegate(self)
colorEditorDelegate.setItemEditorFactory(colorEditorFactory)
figureEditorFactory = QItemEditorFactory()
figureEditorFactory.registerEditor(QVariant.String, FigureListItemEditorCreator())
figureEditorDelegate = QStyledItemDelegate(self)
figureEditorDelegate.setItemEditorFactory(figureEditorFactory)
self.regionTableWidget.cellChanged.connect(self.regionTableWidgetCellChanged)
self.regionTableWidget.setColumnCount(3)
self.regionTableWidget.setItemDelegateForColumn(1, colorEditorDelegate)
self.regionTableWidget.setItemDelegateForColumn(2, figureEditorDelegate)
self.regionTableWidget.setHorizontalHeaderLabels(["Name", "Color", "Type"])
self.regionTableWidget.verticalHeader().setVisible(False)
self.regionTableWidget.resize(150, 50)
qApp = QtWidgets.qApp
self.upRegionButton.setIcon(qApp.style().standardIcon(QStyle.SP_ArrowUp))
self.downRegionButton.setIcon(qApp.style().standardIcon(QStyle.SP_ArrowDown))
self.addRegionButton.clicked.connect(self.addRegionButtonClicked)
self.removeRegionButton.clicked.connect(self.removeRegionButtonClicked)
self.upRegionButton.clicked.connect(self.upRegionButtonClicked)
self.downRegionButton.clicked.connect(self.downRegionButtonClicked)
self.radiusSpinBox.valueChanged.connect(self.radiusSpinBoxValueChanged)