本文整理汇总了Python中PyQt5.QtCore.Qt.PartiallyChecked方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.PartiallyChecked方法的具体用法?Python Qt.PartiallyChecked怎么用?Python Qt.PartiallyChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.PartiallyChecked方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __GetFields
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import PartiallyChecked [as 别名]
def __GetFields(self, parent):
fields = []
for i in range(parent.childCount()):
childItem = parent.child(i)
# leaf
if childItem.childCount() == 0:
if childItem.checkState(0) == Qt.Checked:
field = self.__GetFieldByShowName(self._fields, childItem.text(0))
fields.append(field)
continue
if childItem.checkState(0) == Qt.Checked or childItem.checkState(0) == Qt.PartiallyChecked:
field = self.__GetFields(childItem)
fields.extend(field)
return fields
示例2: __UpdateParent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import PartiallyChecked [as 别名]
def __UpdateParent(self, child):
parent = child.parent()
if parent is None or parent is self: return
partiallySelected = False
selectedCount = 0
childCount = parent.childCount()
for i in range(childCount):
childItem = parent.child(i)
if childItem.checkState(0) == Qt.Checked:
selectedCount += 1
elif childItem.checkState(0) == Qt.PartiallyChecked:
partiallySelected = True
if partiallySelected:
parent.setCheckState(0, Qt.PartiallyChecked)
else:
if selectedCount == 0:
parent.setCheckState(0, Qt.Unchecked)
elif selectedCount > 0 and selectedCount < childCount:
parent.setCheckState(0, Qt.PartiallyChecked)
else:
parent.setCheckState(0, Qt.Checked)
self.__UpdateParent(parent)
示例3: enable_check
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import PartiallyChecked [as 别名]
def enable_check(self, enabled):
self.group.setCheckable(enabled)
self.group.setChecked(False)
self.noOutputCheckBox.setTristate(enabled)
if enabled:
self.noOutputCheckBox.setCheckState(Qt.PartiallyChecked)
self.noErrorCheckBox.setTristate(enabled)
if enabled:
self.killCheckBox.setCheckState(Qt.PartiallyChecked)
self.killCheckBox.setTristate(enabled)
if enabled:
self.killCheckBox.setCheckState(Qt.PartiallyChecked)
示例4: get_settings
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import PartiallyChecked [as 别名]
def get_settings(self):
settings = {}
if not (self.group.isCheckable() and not self.group.isChecked()):
if self.commandLineEdit.text().strip():
settings['command'] = self.commandLineEdit.text()
if self.noOutputCheckBox.checkState() != Qt.PartiallyChecked:
settings['no_output'] = self.noOutputCheckBox.isChecked()
if self.noErrorCheckBox.checkState() != Qt.PartiallyChecked:
settings['no_error'] = self.noErrorCheckBox.isChecked()
if self.killCheckBox.checkState() != Qt.PartiallyChecked:
settings['kill'] = self.killCheckBox.isChecked()
return settings
示例5: group_check_state
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import PartiallyChecked [as 别名]
def group_check_state(self):
if not self.is_group:
return None
if self.childCount() == 0:
return Qt.Unchecked
if all(child.show for child in self.children):
return Qt.Checked
elif any(child.show for child in self.children):
return Qt.PartiallyChecked
else:
return Qt.Unchecked