Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the empty space at the left of a QTreeView

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.

QTreeview spacing

like image 415
cassandrad Avatar asked Dec 12 '22 08:12

cassandrad


2 Answers

I had the same problem with QTreeWidgets, they have a "rootIsDecorated" setting that is enabled by default. Disable it, job done.

like image 67
user3305609 Avatar answered Dec 31 '22 00:12

user3305609


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.

like image 33
cassandrad Avatar answered Dec 30 '22 22:12

cassandrad