PDA

View Full Version : QTreeView automatic Widget Height adjustment



mqt
4th October 2013, 07:53
I am creating QTreeView with QStandardDataModel. The Height if the widget seems to be bigger than needed. How to fix it? Also I would like to edit the height of TreeView dynamically so that it is just enough to fit the current data / expansion state. Please help

aamer4yu
5th October 2013, 10:10
Also I would like to edit the height of TreeView dynamically so that it is just enough to fit the current data / expansion state
It wont be a good idea. TreeView will be inherited from scroll area and will provide a scroll bar if the height of items is more than the height of the view.

You might try playing with QStandardItem::sizeHint

mqt
5th October 2013, 11:42
It will not be good when the contents are more. My problem is that, it comes with lot of blank area even though the contents are less. I want to avoid that space initially.When someone expands the view should become bigger upto a limit and then it scroll bar should appear.