]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiWorkArea.cpp
Fix reloading of local layout file (bug #11120)
[lyx.git] / src / frontends / qt4 / GuiWorkArea.cpp
index 4adb155fa2573b2b49bd1d18b53b7ddc5d8daf95..129656444b73b5a6e9ef33d41cd48b52abae3774 100644 (file)
@@ -897,7 +897,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:
@@ -1252,6 +1268,8 @@ void GuiWorkArea::paintEvent(QPaintEvent * ev)
                // backing store has to be copied to screen (this is a no-op
                // except on macOS).
                d->updateScreen(ev->rect());
+               // Ignore this paint event, but request a new one for later.
+               viewport()->update(ev->rect());
                ev->accept();
                return;
        }