I have a subclassed QTreeView
. I need to make it looks like simple QListView
without space (left corner spacing) for child items. What should I do? Qt is 4.7.4.
Already tried setRootIsDecorated
and it doesn't help. I have tried QTreeView::setIndentation
, but it doesn't help too.
Asked
Active
Viewed 3,503 times
4

cassandrad
- 3,412
- 26
- 50
-
Try using `QTreeView::setIndentation` – hank Dec 26 '13 at 14:15
-
There is the same [question](http://stackoverflow.com/questions/11499808/how-to-modify-the-qtreewidget). – cassandrad Dec 26 '13 at 14:15
-
If it doesn' help show how you fill your treeview. – hank Dec 26 '13 at 14:17
-
Great answer! I fill my tree views from model too and I don't have any problems with the indentation :/ – hank Dec 26 '13 at 14:29
-
Ok. Which method do you want to see? – cassandrad Dec 26 '13 at 14:34
-
Provide a [SSCCE](http://sscce.org). Just show how you add those three elements in your picture. – hank Dec 26 '13 at 14:40
2 Answers
9
I had the same problem with QTreeWidgets, they have a "rootIsDecorated" setting that is enabled by default. Disable it, job done.

user3305609
- 145
- 1
- 9
5
The problem was in the methods which somehow changes my QTreeView
. So, setting indentation after this methods solved the problem. But I still don't understand why setting indentation in the constructor of QTreeView
was useless.

cassandrad
- 3,412
- 26
- 50