Skip to content

Commit 4f6540a

Browse files
committed
don't emit scroll up/down together with scroll left/right
1 parent cc2e5a1 commit 4f6540a

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

src/OpenCOVER/plugins/general/WindowTypeQt/QtOsgWidget.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -462,19 +462,26 @@ void QtOsgWidget::wheelEvent(QWheelEvent *event)
462462
setKeyboardModifiers(event);
463463
event->accept();
464464
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
465-
osgGA::GUIEventAdapter::ScrollingMotion motion =
466-
event->angleDelta().y()>0 ? osgGA::GUIEventAdapter::SCROLL_UP : osgGA::GUIEventAdapter::SCROLL_DOWN;
467-
if (event->angleDelta().x() != 0)
468-
motion = motion = event->angleDelta().x() >0 ? osgGA::GUIEventAdapter::SCROLL_LEFT : osgGA::GUIEventAdapter::SCROLL_RIGHT;
469-
465+
if (event->angleDelta().y() != 0)
466+
{
467+
auto motion =
468+
event->angleDelta().y() > 0 ? osgGA::GUIEventAdapter::SCROLL_UP : osgGA::GUIEventAdapter::SCROLL_DOWN;
469+
getEventQueue()->mouseScroll(motion);
470+
}
471+
else if (event->angleDelta().x() != 0)
472+
{
473+
auto motion =
474+
event->angleDelta().x() > 0 ? osgGA::GUIEventAdapter::SCROLL_LEFT : osgGA::GUIEventAdapter::SCROLL_RIGHT;
475+
getEventQueue()->mouseScroll(motion);
476+
}
470477
#else
471478
int delta = event->delta();
472479
osgGA::GUIEventAdapter::ScrollingMotion motion =
473480
delta>0 ? osgGA::GUIEventAdapter::SCROLL_UP : osgGA::GUIEventAdapter::SCROLL_DOWN;
474481
if (event->orientation() == Qt::Horizontal)
475-
motion = delta>0 ? osgGA::GUIEventAdapter::SCROLL_LEFT : osgGA::GUIEventAdapter::SCROLL_RIGHT;
476-
#endif
482+
motion = delta > 0 ? osgGA::GUIEventAdapter::SCROLL_LEFT : osgGA::GUIEventAdapter::SCROLL_RIGHT;
477483
getEventQueue()->mouseScroll(motion);
484+
#endif
478485
}
479486

480487
osgGA::EventQueue* QtOsgWidget::getEventQueue() const

0 commit comments

Comments
 (0)