Results 1 to 2 of 2

Thread: QTreeView::isFirstColumnSpanned() - how to use it with a custom model??

  1. #1
    Join Date
    May 2009
    Posts
    12
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QTreeView::isFirstColumnSpanned() - how to use it with a custom model??

    Hi,

    I have a QTreeView and a custom model.
    I would like all of my root nodes to have their first column spanned. How do I do it?

    I see there is QTreeView::isFirstColumnSpanned(), but its virtual so I can't override that. I can only use
    QTreeView::setFirstColumnSpanned(int row, QModelIndex, bool), but that means I need to know in advance how many rows my model has, AND get all their indexes, then call this function multiple times. And then do it again whenever I change the model's contents.

    Seems like a crazy design? Why isn't there a 'FirstColumnSpannedRole' or something like that? There are all sorts of other display-orientated roles that I could use.

    thanks,
    Paul

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreeView::isFirstColumnSpanned() - how to use it with a custom model??

    QTreeView::isFirstColumnSpanned() is not related to a model but purely internal to QTreeView.

    I agree with you that this is not really convenient (esp. that you have to re-set it when the model is changed, or filtered...).

    As you can see by the existence of QAbstractItemModel::span() there are plans for proper support of that feature. But these plans have been plans for a long time now...

Similar Threads

  1. QTreeView and custom model from QAbstractItemModel
    By croscato in forum Qt Programming
    Replies: 5
    Last Post: 18th January 2010, 16:03
  2. Replies: 12
    Last Post: 5th July 2009, 16:03
  3. Custom Model Advice Requested
    By mclark in forum Qt Programming
    Replies: 3
    Last Post: 18th September 2008, 16:26
  4. Custom proxy model issue
    By Khal Drogo in forum Qt Programming
    Replies: 13
    Last Post: 30th November 2007, 12:41
  5. Treeview and custom model
    By steg90 in forum Qt Programming
    Replies: 8
    Last Post: 15th May 2007, 13:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.