I populate nested lists in a QTreeWidget, and I need to disable the selection of parent rows.
The code is:
def fillTree(self):
'''
Fill UI with list of parts
'''
roots = ['APLE', 'ORANGE', 'MANGO']
childs = ['body', 'seed', 'stern']
parent = self.treeWidget.invisibleRootItem()
for root in roots:
widgetTrim = QTreeWidgetItem()
widgetTrim.setText(0, root)
parent.addChild(widgetTrim)
for child in childs:
widgetPart = QTreeWidgetItem()
widgetPart.setText(0, child)
widgetTrim.addChild(widgetPart)
I need to avoid selection of the "fruit" items.