Hi,
is it possible to do something similar to this in Qt?
http://objectlistview.sourceforge.ne...-grouplistview
Cheers,
Aya
Hi,
is it possible to do something similar to this in Qt?
http://objectlistview.sourceforge.ne...-grouplistview
Cheers,
Aya
Yes. Next time please open the documentation and search a little bit and/or post such questions in the newbie section. (moved!)
See QTreeView or QTreeWidget.
I don't see how I can do this with QTreeView/QTreeWidget by default - have you looked at the website link I posted??
How can I do this grouping with QTreeView/QTreeWidget?
Yes, but have you read the documentation to QTreeView? Isn't the image https://qt-project.org/doc/qt-4.8/im...h-treeview.png almost what you want? The grouping must be indeed be done by the model or you, when using QTreeWidget.
The only difference I can see is the space betweeen top-level items. Subclassing QTreeView and reimplementing visualRect() should be enough to obtain that.
Hi,
the GroupListView on the website is more than just a simple QTreeWidget/View..
The big difference is the grouping (in the example the rows with blue background) - Sure, I can do this by simply add an QTreeWidgetItem (or via a Model for QTreeView), but the text of the group-row can be longer than the cell it is in.
So what I need (if I have to do the grouping myself) is the ability to have a row that ignores the column boundaries.
I am not sure how I should describe it, in html it would be <td colspan="5">...
Aya
As told, reading the documentation could help: QTreeView::setFirstColumnSpanned(). And the styling of the items can be easily done with a proper delegate. You might also want to read about model & view architecture in Qt.
Thanks a lot, setFirstColumnSpanned() was very helpfull.
Aya
PS: Next time I will read trough the whole documentation before asking a question in this forum.. seems as if I got the idea of this forum wrong.
Bookmarks