View Full Version : QTreeView height issue

23rd October 2013, 07:39
I am using QTreeView and QStandardItemModel. I am inserting the QTreeView inside a Widget Thru QGridLayout. I want the Tree View to be expanded when the parent widget is expanded. I tried with Size policy, resetSize, etc. But nothing worked. In-fact it expands horizontally as expected. But the Height is expanded to a limit and then stops after a limit. This happens even when the contents are much bigger than available area. How to solve this?

23rd October 2013, 07:56
Demo app with the issue?

23rd October 2013, 08:36
The question is very simple. How to make the QTreeView (white area) always touch its parents borders irrespective of content size? I am using grid layout. First row of the layout contains a button of fixed height. I am Adding QTreeview in second row. I am using "preferred" policy (I almost tried all combinations) for both parent and tree. Now when I increase the height of parent widget, the height for tree view also increase for some time as expected (The scroll bar appears if content size more irrespective of expanding-good). But after some time it stops expanding and instead moves downward along with bottom border of parent leaving a gap between button (which is in the first row of grid) and tree (which is in the second row of the grid). I have tried setMaximumHeight for tree, but not worked