diff options
-rw-r--r-- | src/core/web_event_factory.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 65f8431d7..7f164d6bd 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -72,12 +72,12 @@ #include <QCoreApplication> #include <QElapsedTimer> +#include <QGuiApplication> #include <QKeyEvent> #include <QMouseEvent> +#include <QStyleHints> #include <QWheelEvent> -static const int wheelScrollLines = 3; // FIXME: Still not available in QStyleHints in 5.1 - using namespace blink; static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad) @@ -1268,6 +1268,11 @@ blink::WebMouseWheelEvent WebEventFactory::toWebWheelEvent(QWheelEvent *ev, doub // a pixel delta based on ticks and scroll per line. static const float cDefaultQtScrollStep = 20.f; +#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)) + const int wheelScrollLines = QGuiApplication::styleHints()->wheelScrollLines(); +#else + const int wheelScrollLines = 3; +#endif webEvent.deltaX = webEvent.wheelTicksX * wheelScrollLines * cDefaultQtScrollStep; webEvent.deltaY = webEvent.wheelTicksY * wheelScrollLines * cDefaultQtScrollStep; |