From 3ce9863d110a7971339d1f9e76f83f7842c73809 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Tue, 17 Oct 2023 20:24:51 +0200 Subject: [PATCH] Gui: Target 3DViewer directly for overlay wheel events Fixes: #11015 --- src/Gui/OverlayManager.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Gui/OverlayManager.cpp b/src/Gui/OverlayManager.cpp index 5cb79b4eb1..d4eb3129a6 100644 --- a/src/Gui/OverlayManager.cpp +++ b/src/Gui/OverlayManager.cpp @@ -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(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(parent)) { lastIntercept = parent; + break; } }