本文整理汇总了Python中PyQt5.QtWidgets.QTreeWidget.blockSignals方法的典型用法代码示例。如果您正苦于以下问题:Python QTreeWidget.blockSignals方法的具体用法?Python QTreeWidget.blockSignals怎么用?Python QTreeWidget.blockSignals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QTreeWidget
的用法示例。
在下文中一共展示了QTreeWidget.blockSignals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QrcPackageEditor
# 需要导入模块: from PyQt5.QtWidgets import QTreeWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QTreeWidget import blockSignals [as 别名]
#.........这里部分代码省略.........
self.package_changed.emit()
def _get_items(self):
""" Return an iterator over the tree widget items. """
it = QTreeWidgetItemIterator(self._package_edit)
if self._show_root:
it += 1
itm = it.value()
while itm is not None:
yield itm
it += 1
itm = it.value()
def _include_all(self, _):
""" Invoked when the user clicks on the include all button. """
for itm in self._get_items():
itm.setCheckState(0, Qt.Checked)
def _exclude_all(self, _):
""" Invoked when the user clicks on the exclude all button. """
for itm in self._get_items():
if not itm.isDisabled():
itm.setCheckState(0, Qt.Unchecked)
itm.setExpanded(False)
def _remove_all(self, _):
""" Invoked when the use clicks on the remove all button. """
blocked = self._package_edit.blockSignals(True)
self._package_edit.clear()
self._package_edit.blockSignals(blocked)
self._enable_buttons()
# This is a bit of a hack but is currently the only way to completely
# remove the application package.
if self._show_root:
self.package.name = ''
del self.package.contents[:]
self.package_changed.emit()
def _enable_buttons(self):
""" Set the enabled state of those buttons that require content. """
enable = (len(list(self._get_items())) != 0)
self._remove_button.setEnabled(enable)
self._include_button.setEnabled(enable)
self._exclude_button.setEnabled(enable)
def _scan(self, _):
""" Invoked when the user clicks on the scan button. """
project = self.project
package = self.package
# Get the root directory to scan.
root = self.get_root_dir()
if root == '':
return