QGraphicsView ignore mouseMoveEvent triggered by QGraphicsItem
I have a simple problem that I cannot figure out how to solve. I have a QGraphicsView that has a few QGraphicsItems inside of it. When the user clicks and drags inside the QGraphicsView it scrolls the image. I need to intercept this event, and so I implemented
Code:
void
MyQGraphicsView::
if (event->buttons() == Qt::LeftButton) {
std::cout << "mouse move event\n";
}
}
This part works fine. However, when the user clicks and drags one of the QGraphicsItems, this event is also triggered. I do not want this - I want the mouseMoveEvent in the QGraphicsView only to trigger if the mouse was dragged when not on a QGraphicsItem. Any suggestions?