Results 1 to 2 of 2

Thread: Tri-State checkboxes on QTreeView with QSortFilterProxyModel

  1. #1
    Join Date
    Nov 2010
    Posts
    5
    Qt products
    Qt4
    Platforms
    Windows

    Red face Tri-State checkboxes on QTreeView with QSortFilterProxyModel

    I created a QTreeView. Each node of the tree has a tri-state checkbox. Then I create another instance of the tree using QSortFilterProxyModel. The new instance displays a subset of the tree based on the selected node on the original tree.

    The tri-state checkboxes on both trees work fine. However, when a checkbox state is changed in one tree, the same checkbox is also changed in the other tree. I can understand this is because both trees access the same model.

    Is there a way to have the states of the checkboxes on the two trees to be different?

    Thanks,
    TM

  2. #2
    Join Date
    Mar 2008
    Location
    Marslev, Denmark
    Posts
    31
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Tri-State checkboxes on QTreeView with QSortFilterProxyModel

    Not with QSortFilterProxyModel, because all state is set in the source model.

    You have to implement your own proxy model to do this.
    Bo Thorsen, Viking Software
    Qt applications on Linux and Windows

Similar Threads

  1. Replies: 1
    Last Post: 16th April 2010, 21:59
  2. QTreeView and CheckBoxes
    By FreeG in forum Qt Programming
    Replies: 2
    Last Post: 9th December 2009, 09:36
  3. qtreeview + checkboxes
    By lamera in forum Newbie
    Replies: 9
    Last Post: 6th September 2008, 22:10
  4. QTreeView with checkboxes
    By shad in forum Qt Programming
    Replies: 1
    Last Post: 4th May 2006, 13:29
  5. Replies: 3
    Last Post: 2nd April 2006, 06:48

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.