I have to populate a QTreeWidget with items (or children of items) that may happen to be too long to fit in a single line, so I\'m looking for a way to word wrap them.
I successfully found a workaround: i envelope a QLabel in the WidgetItem, setting the QLabel to have word wrap capabilities.
item = QTreeWidgetItem()
label = QLabel('long text here')
label.setWordWrap(True)
MyTree.addTopLevelItem(item)
MyTree.setItemWidget(item, 0, label)
the behaviour is exactly the one desired!!