From da2e7b1331cb27142058a9f1d1debd363c5dd151 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 3 Jul 2017 15:27:02 +0200 Subject: Use QStyleHints::wheelScrollLines when create WebMouseWheelEvent Change-Id: I01fb4f9ff943df935887b40cb75d7656d2b6ac20 Reviewed-by: Allan Sandfeld Jensen --- src/core/web_event_factory.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') 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 #include +#include #include #include +#include #include -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; -- cgit v1.2.3