本文整理汇总了Python中PyQt5.QtWidgets.QTreeWidget.setItemDelegate方法的典型用法代码示例。如果您正苦于以下问题:Python QTreeWidget.setItemDelegate方法的具体用法?Python QTreeWidget.setItemDelegate怎么用?Python QTreeWidget.setItemDelegate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QTreeWidget
的用法示例。
在下文中一共展示了QTreeWidget.setItemDelegate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EditorConfiguration
# 需要导入模块: from PyQt5.QtWidgets import QTreeWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QTreeWidget import setItemDelegate [as 别名]
#.........这里部分代码省略.........
self._showErrorsOnLine.stateChanged[int].connect(
self._enable_errors_inline)
vboxg3.addWidget(self._checkErrors)
vboxg3.addWidget(self._showErrorsOnLine)
vboxg3.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding))
formFeatures.addWidget(group3, 2, 0)
# Find PEP8 Errors (highlighter)
vboxg4 = QHBoxLayout(group4)
vboxg4.setContentsMargins(5, 15, 5, 5)
vvbox = QVBoxLayout()
self._checkStyle = QCheckBox(
translations.TR_PREFERENCES_EDITOR_CONFIG_SHOW_PEP8)
self._checkStyle.setChecked(settings.CHECK_STYLE)
self._checkStyle.stateChanged[int].connect(self._disable_check_style)
vvbox.addWidget(self._checkStyle)
self._checkStyleOnLine = QCheckBox(
translations.TR_PREFERENCES_EDITOR_CONFIG_SHOW_TOOLTIP_PEP8)
self._checkStyleOnLine.setChecked(settings.CHECK_HIGHLIGHT_LINE)
self._checkStyleOnLine.stateChanged[int].connect(
self._enable_check_inline)
vvbox.addWidget(self._checkStyleOnLine)
vvbox.addItem(QSpacerItem(0, 0,
QSizePolicy.Expanding, QSizePolicy.Expanding))
vboxg4.addLayout(vvbox)
# Container for tree widget and buttons
widget = QWidget()
hhbox = QHBoxLayout(widget)
hhbox.setContentsMargins(0, 0, 0, 0)
# Tree Widget with custom item delegate
# always adds uppercase text
self._listIgnoreViolations = QTreeWidget()
self._listIgnoreViolations.setObjectName("ignore_pep8")
self._listIgnoreViolations.setItemDelegate(ui_tools.CustomDelegate())
self._listIgnoreViolations.setMaximumHeight(80)
self._listIgnoreViolations.setHeaderLabel(
translations.TR_PREFERENCES_EDITOR_CONFIG_IGNORE_PEP8)
for ic in settings.IGNORE_PEP8_LIST:
self._listIgnoreViolations.addTopLevelItem(QTreeWidgetItem([ic]))
hhbox.addWidget(self._listIgnoreViolations)
box = QVBoxLayout()
box.setContentsMargins(0, 0, 0, 0)
btn_add = QPushButton(QIcon(":img/add_small"), '')
btn_add.setMaximumSize(26, 24)
btn_add.clicked.connect(self._add_code_pep8)
box.addWidget(btn_add)
btn_remove = QPushButton(QIcon(":img/delete_small"), '')
btn_remove.setMaximumSize(26, 24)
btn_remove.clicked.connect(self._remove_code_pep8)
box.addWidget(btn_remove)
box.addItem(QSpacerItem(0, 0,
QSizePolicy.Fixed, QSizePolicy.Expanding))
hhbox.addLayout(box)
vboxg4.addWidget(widget)
formFeatures.addWidget(group4)
# Show Python3 Migration, DocStrings and Spaces (highlighter)
vboxg5 = QVBoxLayout(group5)
vboxg5.setContentsMargins(5, 15, 5, 5)
self._showMigrationTips = QCheckBox(
translations.TR_PREFERENCES_EDITOR_CONFIG_SHOW_MIGRATION)
self._showMigrationTips.setChecked(settings.SHOW_MIGRATION_TIPS)
vboxg5.addWidget(self._showMigrationTips)
self._checkForDocstrings = QCheckBox(
translations.TR_PREFERENCES_EDITOR_CONFIG_CHECK_FOR_DOCSTRINGS)
self._checkForDocstrings.setChecked(settings.CHECK_FOR_DOCSTRINGS)