Important: Please read the Qt Code of Conduct -

[Solved] QGraphicsWidget subclass does not recieve GraphicsSceneMouseRelease

  • Qt 4.8.1, VS 2010 on Windows

    I have a QGraphicsWidget subclass that should handle some events. Whatever I do, I do not receive the GraphicsSceneMouseRelease event.

    I have reimplemented mouseReleaseEvent, and never get in there.
    I have reimplemented sceneEvent, and get everything but the mouse release event.
    I have reimplemented event, and get everything but the mouse release event

    I have not installed a filter on my object.
    I have not installed a scene filter, nor an application-wide event filter.

    I have checked for bugs containing GraphicsSceneMouseRelease , and found none that matches my problem.


  • Ok, the trick here is to become the mouse grabber. Interestingly, the docs say (about mousePressEvent) that

    bq. If you do reimplement this function, event will by default be accepted (see QEvent::accept()), and this item is then the mouse grabber.

    However, that didn't happen. I had to accept the event myself, then did the mouseReleaseEvent arrive.

Log in to reply