PDA

View Full Version : QGraphicsView, RubberBandMode and signal selectionChanged



maitai
8th June 2011, 13:15
Hello all,

I am using qt 4.7.3 on windows 7.

I have a standard QGraphicsScene and a derived QGraphicsView. I have a button to switch from ScrollHandDrag to RubberBandDrag and vice-versa. When the user is in RubberBandDrag mode, all works as expected (i.e. a selection zone appears on the view), but I am facing various problems with selectionChanged signal:

The documentation says that this signal is emitted whenever the selection list changes, or when the selectionArea changes. But in fact, in case the selection list didn't change but only the selectionArea is changed, the signal is not emitted...

Also, the same documentation says that the signal should be emitted only once, but in fact the signal is emitted each time the selection "hits" a selectable item, although the user has not released the mouse yet.

My biggest problem is the first one, I will be obliged to reimplement mouseRelease event just to get the new scene->selectionArea(), which always changes due to the grab action of the user even if not item is selected or deselected.

Any advice about how I can be informed that the selectionArea changed even if the selectedItems list didn't change?