Take the 2-minute tour ×

I have a base class extending QGraphicsScene...

class BaseScene : public QGraphicsScene

in that class is the protected event...

void BaseScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)

There are some user clicks where I need to pass the event on to the QGraphicsItem inside the QGraphicsScene, as the QGraphicsItem also contains a 'mousePressEvent'.

How can I propergate down events of my choosing from the QGprahicsScene to a specific QGraphicsItem?.

Thank you.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

In your reimplemented mousePressEvent() add:


This will call the default implementation : "The default implementation depends on the state of the scene. If there is a mouse grabber item, then the event is sent to the mouse grabber. Otherwise, it is forwarded to the topmost item that accepts mouse events at the scene position from the event, and that item promptly becomes the mouse grabber item."

Hope this helps

share|improve this answer

Your Answer


