Results 1 to 4 of 4

Thread: Debugging QTreeView Selections

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

    Default Debugging QTreeView Selections

    Hi,

    I have finally managed to build a working custom item model for a treeview.
    The data is updated in bulk, so I've managed to write code that correctly calls the beginInsertRows / beginRemoveRows and the related methods.

    I've tested my model with ModelTest (the QTLabs project), and it appears to work correctly...

    EXCEPT

    If I select a scattering of rows and then update the model so that some other rows in a different subtree are removed, then SOMETIMES, only SOME of the selected rows become unselected. Often two selected rows side by side (with the same parent) will end up as only one selected row.

    Any ideas on how to debug this? Is there some sort of ModelTests-style tester? Are there any known bugs in QTreeView and QSelectionModel ? (I looked in the nokia bug tracker but didn't see anything related)

    Thanks,
    Paul

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Debugging QTreeView Selections

    Could it be that some of the model indexes become invalid after you remove those rows?
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

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

    Default Re: Debugging QTreeView Selections

    I had problems with invalid indexes before, but they seemed to have been all detected by ModelTest, and I've since fixed them. So, no, I don't think there are any model indexes that are invalid.

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

    Default Re: Debugging QTreeView Selections

    Actually, I've just managed to find a way to make ModelTest assert, so I guess there are still problems in my code.

    Its annoying that its so hard to get a model built right !!! Its just a freaking tree... how embarrassing.

Similar Threads

  1. Sharing Selections between Model and ProxyModel
    By mentat in forum Qt Programming
    Replies: 14
    Last Post: 27th January 2010, 17:31
  2. [4.4] vista-like selections are too slow
    By youkai in forum Qt Programming
    Replies: 0
    Last Post: 2nd March 2009, 09:00
  3. QTable selections in Qt3.3
    By Rayven in forum Qt Programming
    Replies: 1
    Last Post: 7th July 2007, 18:07
  4. Selections in a TableView with a QItemSelectionModel
    By xelag in forum Qt Programming
    Replies: 3
    Last Post: 27th November 2006, 09:45
  5. PRIMARY Selections
    By hayati in forum Newbie
    Replies: 9
    Last Post: 12th September 2006, 12:13

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.