summaryrefslogtreecommitdiffstats
path: root/src/core/web_event_factory.cpp
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2017-07-03 15:27:02 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-03 17:03:00 +0000
commitda2e7b1331cb27142058a9f1d1debd363c5dd151 (patch)
treec7c6e89baddd8f04d92ac51de1c5e13729c2a162 /src/core/web_event_factory.cpp
parent601003362c75283e9164e997e3835e7c36c6db00 (diff)
Use QStyleHints::wheelScrollLines when create WebMouseWheelEvent
Change-Id: I01fb4f9ff943df935887b40cb75d7656d2b6ac20 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/web_event_factory.cpp')
-rw-r--r--src/core/web_event_factory.cpp9
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;