Can QTreeWidget have checkboxes at top level if there are no sub-nodes for that parent element?
Solved
Qt for Python
-
I create an item at the top level with the following code.
l1 = QTreeWidgetItem(["String A", "String B", "String C","String D"]) l1.setFlags(l1.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable) l1.setTextAlignment(2, QtCore.Qt.AlignRight)
Everything works fine and the checkbox shows up but only if there are sub-nodes, i.e. child elements. For some top level nodes there are no child elements but I need a checkbox with them. Is that possible? Thanks.
-
I create an item at the top level with the following code.
l1 = QTreeWidgetItem(["String A", "String B", "String C","String D"]) l1.setFlags(l1.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable) l1.setTextAlignment(2, QtCore.Qt.AlignRight)
Everything works fine and the checkbox shows up but only if there are sub-nodes, i.e. child elements. For some top level nodes there are no child elements but I need a checkbox with them. Is that possible? Thanks.