def resolve_item_down_changed(self, item: QObject) -> None: """Put the same state for every child.""" self.update_item_changed(item) state = item.checkState() for idx in range(item.rowCount()): child = item.child(idx) child.setCheckState(state) self.resolve_item_down_changed(child)
def resolve_item_down_changed(self, item: QObject) -> None: """ Put the same state for every child. """ self.update_item_changed(item) state = item.checkState() for idx in range(item.rowCount()): child = item.child(idx) child.setCheckState(state) self.resolve_item_down_changed(child)
def item_check_parent(self, item: QObject) -> None: sum_states = sum( item.child(idx).checkState() == Qt.Checked for idx in range(item.rowCount()) ) if sum_states == item.rowCount(): item.setCheckState(Qt.Checked) else: item.setCheckState(Qt.PartiallyChecked) self.resolve_item_up_changed(item)
def item_check_parent(self, item: QObject) -> None: """Retrieve the state of all children to update its own state accordingly.""" sum_states = sum( item.child(idx).checkState() == Qt.Checked for idx in range(item.rowCount())) if sum_states == item.rowCount(): item.setCheckState(Qt.Checked) else: item.setCheckState(Qt.PartiallyChecked) self.resolve_item_up_changed(item)