0
votes

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.

1

1 Answers

1
votes

In your reimplemented mousePressEvent() add:

QGraphicsScene::mousePressEvent(mouseEvent);

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