Gui: Target 3DViewer directly for overlay wheel events

Fixes: #11015
This commit is contained in:
Kacper Donat
2023-10-17 20:24:51 +02:00
committed by wwmayer
parent c7fd115528
commit 3ce9863d11

View File

@@ -1948,9 +1948,14 @@ void OverlayManager::Private::interceptEvent(QWidget *widget, QEvent *ev)
#endif
lastIntercept = getChildAt(widget, globalPos);
for (auto parent = lastIntercept->parentWidget(); parent; parent = parent->parentWidget()) {
if (qobject_cast<QGraphicsView*>(parent)) {
// For some reason in case of 3D View we have to target it directly instead of targeting
// the viewport of QAbstractScrollArea like it works for all other widgets of that kind.
// That's why for this event we have to traverse up the widget tree to find if it is part
// of the 3D view.
for (auto parent = lastIntercept; parent; parent = parent->parentWidget()) {
if (qobject_cast<View3DInventorViewer*>(parent)) {
lastIntercept = parent;
break;
}
}