I have two different classes inheriting QGraphicsItem
. Both of them have their specific mousePressEvent
functions. When these items overlap on the scene, I want to execute only one of the items' mousePressEvent
. How can I achieve this?
void PpiTargetItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) {
mTargetColor = Qt::red;
event->setAccepted(true);
}
// Bigger Item
void CriticalRegion::hoverEnterEvent(QGraphicsSceneHoverEvent *event) {
LOGGER_START
mCorners[0] = new CornerGrabber(this, 0);
mCorners[1] = new CornerGrabber(this, 1);
mCorners[2] = new CornerGrabber(this, 2);
mCorners[3] = new CornerGrabber(this, 3);
mCorners[0]->installSceneEventFilter(this);
mCorners[1]->installSceneEventFilter(this);
mCorners[2]->installSceneEventFilter(this);
mCorners[3]->installSceneEventFilter(this);
setCornerPositions();
event->setAccepted(true);
LOGGER_END
}