View Full Version : QGraphicsItem event->ignore()

25th October 2007, 12:59
I have a subclassed QGraphicsItem with a reimplemented mousePressEvent in which I only accept the event based on some logic(which works fine).

The problem is the times when the item should not handle the mousePressEvent, due to my test. I call event->ignore, but the item is still the mousegrabber. And prevents me from selecting any other items. FYI, if the test fails I want the "scene" to be the mousegrabber if the test fails.

In the documentation i read:
If you call QEvent::ignore() on event, this item will lose the mouse grab, and event will propagate to any topmost item beneath. No further mouse events will be delivered to this item unless a new mouse press event is received.

If there is no other item beneath, does the view/scene become the mousegrabber automatically?


25th October 2007, 15:56
A "quick fix" that seem to work ok:
If my test to select the item or not fails, I just call
in the the mousePressEvent method.