Results 1 to 4 of 4

Thread: QTreeView, QSortFilterProxyModel and item expansions

  1. #1
    Join Date
    Dec 2007
    Posts
    14
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QTreeView, QSortFilterProxyModel and item expansions

    Hi all,

    I'm facing a weird behaviour and would like some suggestions. I've implemented a softfilterproxymodel to do my custom sorting/filtering in a treeview. The strange thing is that if I expand an item and then recollpase it, after changing the sorting column, the collapsed item may repop in expanded status. Anyone ever faced a similar problem ?

    Keep in mind that if I don't expand any item at application start, I never get an autoexpanded item using the sort. It's like there's some kind of internal memory of the expanded item, but I'm going nut atm....

    Thanks for your support.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTreeView, QSortFilterProxyModel and item expansions

    Can we see some code?

  3. #3
    Join Date
    Dec 2007
    Posts
    14
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTreeView, QSortFilterProxyModel and item expansions

    Code reflects exactly the TreeView model example in the qt documentation.

    A few more hints I just discovered, hope someone is able to show me the light:

    1) The problem isn't in the proxy model, I tried to remove my custom filter/sorting routines and use the base class ones and the problem still persist

    2) The problem happens only if I collapse an item while one of its childs is selected !!!! If I deselect the child and collapse the item, that item never gets auto-expanded again...

    Any hint ?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTreeView, QSortFilterProxyModel and item expansions

    Quote Originally Posted by benacler View Post
    Code reflects exactly the TreeView model example in the qt documentation.
    Well... obviously the example works fine, so the difference between "reflects" and "is identical" is your problem. I'd really suggest posting some code, otherwise there is not much we can do.

Similar Threads

  1. Replies: 5
    Last Post: 6th December 2007, 14:43
  2. QTreeView: selection behavior upon selected item removal
    By Pieter from Belgium in forum Qt Programming
    Replies: 6
    Last Post: 11th July 2007, 16:00
  3. Can't change the text display of a QTreeview item.
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 2nd June 2006, 01:03
  4. Programattically Clicking an Item in QTreeView
    By johnny_sparx in forum Qt Programming
    Replies: 4
    Last Post: 11th May 2006, 16:26
  5. paint QTreeView item !!
    By mcenatie in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2006, 14:24

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.