views:

52

answers:

1

Hello,

We have ListView.Groups in .NET. Is there an equivalent in Qt (without using Windows APIs)?

I am unable to find anything that indicates support for this in the documentation for Qt.

Example in Windows Vista/7: http://i50.tinypic.com/zumgyg.jpg

Thanks in advance!

+3  A: 

It looks like that is very easy to do with Qt model-view control.

It's a little confusing at first, but basically all lists, tree ctrls and grids are treated in the same way - which lets you do interestign combiantions of them very easily.

Edit: Casey posted a useful comment in an answer that was deleted. Here is the text and the link:

creating your tree model is pretty straight forward. To create that "grouped" effect where the parent nodes look different then their children, I would suggest creating an ItemDelegate then setting it on your view using setItemDelegate1. In the Delegate's paint function you can detect whether the index is a header or now, and draw something appropriately. When you get there if you need help, start another question and I can post an example.

http://doc.trolltech.com/4.6/qabstractitemview.html#setItemDelegate

Martin Beckett
Thank you. I'll have a look at that. Anything else that can help is much appreciated.
Sarah
There are examples included with Qt and some tutorials on the web - start here (http://doc.trolltech.com/4.0/qt4-interview.html) for an overview
Martin Beckett
Thank you very much.
Sarah
Somehow Casey's comments disappeared. The most recent one had very valuable information and I was not able to see it before it disappeared. I can see most of it though under "Recent Activity". Casey said (in short), "To create that 'grouped' effect where the parent nodes look different then their children, I would suggest creating an ItemDelegate then setting it on your view using setItemDelegate. In the Delegate's paint function you can detect whether the index is a header or row, and draw something appropriately".I think that's the best answer I got so far. Thank you, Casey!
Sarah
@Sarah - when an owner deletes an answer, unfortunately any comments are also deleted. If you have 10K rep you can read them. I have added casey's comment to my answer.
Martin Beckett
That's nice of you, Martin. Thanks again! :)
Sarah