Python PyQt5.QtCore.Qt.PartiallyChecked() Examples

The following are 7 code examples of PyQt5.QtCore.Qt.PartiallyChecked(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtCore.Qt , or try the search function .
Example #1
Source File: DyTreeWidget.py    From DevilYuan with MIT License 7 votes vote down vote up
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 
Example #2
Source File: DyTreeWidget.py    From DevilYuan with MIT License 6 votes vote down vote up
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 
Example #3
Source File: DyTreeWidget.py    From DevilYuan with MIT License 5 votes vote down vote up
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) 
Example #4
Source File: command_cue.py    From linux-show-player with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #5
Source File: command_cue.py    From linux-show-player with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #6
Source File: ProtocolTreeItem.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #7
Source File: DyTreeWidget.py    From DevilYuan with MIT License 5 votes vote down vote up
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)