[Interest] Grouping Items in TreeWidget
Joseph W. Joshua
joshua at megvel.me.ke
Wed Nov 20 10:58:50 CET 2013
On 20-Nov-13 12:36 PM, André Somers wrote:
> Joseph W. Joshua schreef op 20-11-2013 9:40:
>> Hi all,
>> In the attached image, you can see how I am able to group items in a
>> listview in .NET. Is there a way to achieve this in Qt? I have tried
>> several avenues with no apparent success.
> Sure, this is doable, but it takes a little work.
> You're going to need a delegate to render your header items. You make
> the delegate return a sizehint for the item (to get the extra height).
> You can make it draw the underline, and if you want you can also make it
> do the column spanning, though that's a bit trickier. It might be easier
> to use QTreeView::setFirstColumnSpanned for that, even though that
> breaks the model/view pattern.*
> [*] I don't get why QAbstractItemModel::span was never actualy used in
> Qt. I had to write my own delegate that uses it to get it to work.
Thank you, André.
I will try your suggestions and revert.
More information about the Interest