示例#1
0
 def checkbox_toggled(self, node: QTreeWidgetItem, column: int):
     if node.checkState(column) == Qt.Checked:
         self.selectedList.append(
             [node.text(0), node.text(1),
              node.text(2)])
     elif node.checkState(column) == Qt.Unchecked:
         if len(self.selectedList) > 1:
             self.selectedList.remove(
                 [node.text(0), node.text(1),
                  node.text(2)])
         else:
             self.selectedList = []
示例#2
0
        def maintain_model(item: QTreeWidgetItem, _):
            option = item.text(0)
            if not is_option(option):
                return

            checked = item.checkState(0)
            if (option in self._options) == checked:
                return

            if checked:
                self._options.add(option)
            else:
                self._options.remove(option)

            for child in children_items:
                if child is not item and child.text(0) == option:
                    child.setCheckState(0, checked)
示例#3
0
 def item_changed(item: QTreeWidgetItem, index: int):
     node = item.data(1, 0)
     selected = as_selection(item.checkState(index))
     set_selection_down(node, selected)
     set_selection_up(node)
 def __change_item_check_state_by_item_pressed(cls, item: QTreeWidgetItem,
                                               col):
     if item.checkState(col) == Qt.Checked:
         item.setCheckState(col, Qt.Unchecked)
     else:
         item.setCheckState(col, Qt.Checked)