PDA

View Full Version : QTreeView item size



gusa
23rd November 2015, 12:26
Hello. I have a problem with QTreeVew: standard implementation of QTreeView laying out elements in a tabular form and when i expand a branch, QTreeView draws expanded branch with spaces between elements.
11532
I want get rid of the spaces between elements, but need elements to be separate items.
11533
I tried to inherit from QTreeView and reimplement method QTreeView::drawRow() (http://doc.qt.io/qt-4.8/qtreeview.html#drawRow), where i calculate sizes for elements without spaces. But if i do so, i need to reimplement methods QTreeView::indexAt() (http://doc.qt.io/qt-4.8/qtreeview.html#indexAt) and QTreeView::visualRect() (http://doc.qt.io/qt-4.8/qtreeview.html#visualRect) and calculate sizes again in both methods. I can calculate sizes once and save them, but then i need to implement most of functionality of QTreeView myself, and it would be a better idea to inherit from QAbstractItemView, and that is realy inconvinient.
Is there an easier way to get what i need?