]> git.lyx.org Git - features.git/commitdiff
Fix computation of scroll value
authorGuillaume Munch <gm@lyx.org>
Fri, 27 May 2016 22:59:25 +0000 (23:59 +0100)
committerGuillaume Munch <gm@lyx.org>
Mon, 13 Jun 2016 07:46:15 +0000 (08:46 +0100)
src/frontends/qt4/GuiWorkArea.cpp

index 7100c8bc04b09d960636f8a5c8a3f5d8453f5201..fb97fced44b35a72e0af2ce2bec8c52a705b8fe8 100644 (file)
@@ -937,8 +937,10 @@ void GuiWorkArea::wheelEvent(QWheelEvent * ev)
        int const lines = qApp->wheelScrollLines();
        int const page_step = verticalScrollBar()->pageStep();
        // Test if the wheel mouse is set to one screen at a time.
-       int scroll_value = lines > page_step
-               ? page_step : lines * verticalScrollBar()->singleStep();
+       // This is according to
+       // https://doc.qt.io/qt-5/qapplication.html#wheelScrollLines-prop
+       int scroll_value =
+               min(lines * verticalScrollBar()->singleStep(), page_step);
 
        // Take into account the rotation and the user preferences.
        scroll_value = int(scroll_value * delta * lyxrc.mouse_wheel_speed);