Important: Please read the Qt Code of Conduct -

Passing on (mouse) events from a QGraphicsItem to other QGraphicsItems that occupy the same pixel

  • Hi,

    When I click on my graphics scene, I want not just the graphics item under the cursor with the highest priority to receive it - I want all items under that position to receive the event.

    I've tried to call event->ignore() in my mouse press event handler in my QGraphicsItem subclass, but that screws up drag & drop. (If this is important, I can elaborate on exactly how it screws it up).

    Do you think event->ignore() is the way to go, or is there another way? It doesn't "feel" right, since I don't actually ignore the event - I just want other items to receive it as well. If there were a method called setContinueEventPropagation or similar, that would seem to better express what I'm trying to do.

    If this is not possible, I can introduce my own methods in my QGraphicsItem subclasses to handle events manually, but that's extra work.

  • Lifetime Qt Champion


    You might be interested by "QGraphicsScene::sendEvent":

    Hope it helps

  • Thank for the pointer! I'll go have a look.

Log in to reply