From 7ee4aa329e36209c6f4ba6654a939483e5014578 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Tue, 24 Oct 2023 11:58:02 +0800 Subject: [PATCH] Gui: fix overlay mouse wheel pass through on Windows --- src/Gui/OverlayWidgets.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Gui/OverlayWidgets.cpp b/src/Gui/OverlayWidgets.cpp index 678d7c02a936..9744ab32057e 100644 --- a/src/Gui/OverlayWidgets.cpp +++ b/src/Gui/OverlayWidgets.cpp @@ -4437,6 +4437,13 @@ void OverlayManager::Private::interceptEvent(QWidget *widget, QEvent *ev) case QEvent::Wheel: { auto we = static_cast(ev); lastIntercept = getChildAt(widget, we->globalPos()); + if (qobject_cast(lastIntercept->parentWidget())) { + for (auto parent = lastIntercept->parentWidget(); parent; parent = parent->parentWidget()) { + if (qobject_cast(parent)) { + lastIntercept = parent; + } + } + } #if QT_VERSION >= QT_VERSION_CHECK(5,12,0) QWheelEvent wheelEvent(lastIntercept->mapFromGlobal(we->globalPos()), we->globalPos(), @@ -4466,12 +4473,6 @@ void OverlayManager::Private::interceptEvent(QWidget *widget, QEvent *ev) case QEvent::ContextMenu: { auto ce = static_cast(ev); lastIntercept = getChildAt(widget, ce->globalPos()); - for (auto parent = lastIntercept->parentWidget(); parent; parent = parent->parentWidget()) { - if (qobject_cast(parent)) { - lastIntercept = parent; - } - } - QContextMenuEvent contextMenuEvent(ce->reason(), lastIntercept->mapFromGlobal(ce->globalPos()), ce->globalPos());