PDA

View Full Version : Keeping a QTreeView's and a QGraphicsView's selection in sync



caduel
12th July 2008, 21:15
I am visualizing some data in both a QTreeView and a QGraphicsView.
(No, the QGraphicsView does not use the QAbstractItemModel... yet.)

I want to keep the selections in sync.
Right now, I have connected to the respective selection changed signals, and update the other view's selection in the connectd slot.

This would lead to recursion, as updating one selection, causes a change in the other etc.
I protect against this 'manually': I set a bool flag to mark that I am already updating the selection and thus prevent endless updates.

Is there a better way to do it?

Regards
Christoph