Example #1
0
 def add_widget(self, button, widget):
     """creates a QWidgetItem containing the widget,
     as child of the button-QWidgetItem
     """
     section = QTreeWidgetItem(button)
     section.setDisabled(True)
     self.tree.setItemWidget(section, 0, widget)
     return section
 def changeState(checkbox: CheckBoxAction,
                 item: QtWidgets.QTreeWidgetItem):
     if (checkbox.avoidInternalChecking):
         checkbox.avoidInternalChecking = False
         item.setDisabled(not (checkbox.isChecked()))
     else:
         item.setDisabled(not (checkbox.isChecked()))
         for i in range(item.childCount()):
             subitem = item.child(i)
             subcheckbox = subitem.treeWidget().itemWidget(
                 subitem, 2)
             if (subcheckbox):
                 subitem.setDisabled(not (subcheckbox.isChecked()))
                 subcheckbox.setChecked(checkbox.isChecked())
             else:
                 log("[  WARN  ] Unable to disable/enable other checkboxes"
                     )