I have a QTreeWidget and I want children of a QTreeWidgetItem not indent when I expand them. I want to set the line only for top items. The first screenshot demonstrates what I would like to have, and the second what I am currently having. Would you please help me with how to change it to be like the first one? Thank you in advance!

first picture

second picture![][1]

有帮助吗?

解决方案

This is not possible by QTreeWidget since you can only set the indentation globally. You would need to create your own class implementing this logic, e.g. QListWidgets connected to each other, or just a brand new tree widget implementation. You could also of course improve the existing QTreeWidget and send a patch.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top