[Interest] Revert the selection in a QTreeView

Glenn Ramsey gr at componic.co.nz
Tue Jan 13 22:45:08 CET 2015


Hi,

In a QTreeView how can I revert the selection?

The behaviour I want is that when the user selects an item, then based on some
other state, it will either accept the selection or message the user and revert
to the previous selection.

The currentChanged method gives me the QModelIndex of the previous selection so
I can use treeview.setCurrentIndex to set it to the previous index, but this
causes recursion.

I guess I could use a flag to prevent the recursion, but I'm wondering if there
is a better way to get the same behaviour.

Glenn



More information about the Interest mailing list