Skip to content

Commit

Permalink
Gui: fix overlay mouse wheel pass through on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder committed Oct 24, 2023
1 parent fa2127d commit 7ee4aa3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Gui/OverlayWidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4437,6 +4437,13 @@ void OverlayManager::Private::interceptEvent(QWidget *widget, QEvent *ev)
case QEvent::Wheel: {
auto we = static_cast<QWheelEvent*>(ev);
lastIntercept = getChildAt(widget, we->globalPos());
if (qobject_cast<View3DInventorViewer*>(lastIntercept->parentWidget())) {
for (auto parent = lastIntercept->parentWidget(); parent; parent = parent->parentWidget()) {
if (qobject_cast<QGraphicsView*>(parent)) {
lastIntercept = parent;
}
}
}
#if QT_VERSION >= QT_VERSION_CHECK(5,12,0)
QWheelEvent wheelEvent(lastIntercept->mapFromGlobal(we->globalPos()),
we->globalPos(),
Expand Down Expand Up @@ -4466,12 +4473,6 @@ void OverlayManager::Private::interceptEvent(QWidget *widget, QEvent *ev)
case QEvent::ContextMenu: {
auto ce = static_cast<QContextMenuEvent*>(ev);
lastIntercept = getChildAt(widget, ce->globalPos());
for (auto parent = lastIntercept->parentWidget(); parent; parent = parent->parentWidget()) {
if (qobject_cast<QGraphicsView*>(parent)) {
lastIntercept = parent;
}
}

QContextMenuEvent contextMenuEvent(ce->reason(),
lastIntercept->mapFromGlobal(ce->globalPos()),
ce->globalPos());
Expand Down

0 comments on commit 7ee4aa3

Please sign in to comment.