GraphicsView: Force event propagation to parent item
I use QGraphicsTextItem to display and edit a text. QGraphicsTextItem basically does all the UI interactions itself: Shows a frame when it gets the focus, handles mouse clicks and keyboard events.
There are times I don't want this. I have tried subclassing QGraphicsTextItem and reimplementing sceneEvent, as well as installing a scene event filter on it. Both approaches work perfectly fine as far as event filtering is concerned.
However...I want the (now unhandled) events to propagate to the item's parent and further on, so they can be handled there. When installing an event filter, that doesn't happen. When reimplementing sceneEvent and simply returning 'false', it doesn't happen.
The only thing that seems to work is to reimplement every single event QGraphicsItem offers.
Is there a way to tell the event filter it should directly forward the events to the item's parents, as if they were unhandled?
Just a shot into the darkness, as I don't have experience with event filters: have you tried a simple QEvent::setAccepted(false) in your event handler? In normal operation (without filters) this causes the even to be propagated.
Good point. I'll try. Thanks!