PDA

View Full Version : Tri-State checkboxes on QTreeView with QSortFilterProxyModel



tmmak
2nd December 2010, 05:47
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

bothorsen
2nd December 2010, 10:07
Not with QSortFilterProxyModel, because all state is set in the source model.

You have to implement your own proxy model to do this.