]> git.lyx.org Git - features.git/commitdiff
Ignore horizontal wheel scrolling in workarea
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 20 Sep 2018 21:21:41 +0000 (23:21 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 20 Sep 2018 21:25:42 +0000 (23:25 +0200)
We do not know what to do with horizontal scrolling events, so we ignore them.

Note that the code has to be different between Qt4 and Qt5.

Fixes bug #11257.

src/frontends/qt4/GuiWorkArea.cpp

index 45c4469e61e13e7d0bce1872ddbdae53feddbbd9..2df9342c5a5823d0917c6d06c3a071f7ca2f675d 100644 (file)
@@ -900,7 +900,23 @@ void GuiWorkArea::wheelEvent(QWheelEvent * ev)
 {
        // Wheel rotation by one notch results in a delta() of 120 (see
        // documentation of QWheelEvent)
+       // But first we have to ignore horizontal scroll events.
+#if QT_VERSION < 0x050000
+       if (ev->orientation() == Qt::Horizontal) {
+               ev->accept();
+               return;
+       }
        double const delta = ev->delta() / 120.0;
+#else
+       QPoint const aDelta = ev->angleDelta();
+       // skip horizontal wheel event
+       if (abs(aDelta.x()) > abs(aDelta.y())) {
+               ev->accept();
+               return;
+       }
+       double const delta = aDelta.y() / 120.0;
+#endif
+
        bool zoom = false;
        switch (lyxrc.scroll_wheel_zoom) {
        case LyXRC::SCROLL_WHEEL_ZOOM_CTRL: