summaryrefslogtreecommitdiffstats
path: root/src/core/web_event_factory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/web_event_factory.cpp')
-rw-r--r--src/core/web_event_factory.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index 505a684eb..10809a764 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -659,14 +659,11 @@ blink::WebMouseWheelEvent WebEventFactory::toWebWheelEvent(QWheelEvent *ev, doub
webEvent.modifiers = modifiersForEvent(ev);
webEvent.timeStampSeconds = currentTimeForEvent(ev);
- if (ev->orientation() == Qt::Horizontal)
- webEvent.wheelTicksX = ev->delta() / 120.0f;
- else
- webEvent.wheelTicksY = ev->delta() / 120.0f;
+ webEvent.wheelTicksX = ev->angleDelta().x() / QWheelEvent::DefaultDeltasPerStep;
+ webEvent.wheelTicksY = ev->angleDelta().y() / QWheelEvent::DefaultDeltasPerStep;
-
- // Since we report the scroll by the pixel, convert the delta to pixel distance using standard scroll step.
- // Use the same single scroll step as QTextEdit (in QTextEditPrivate::init [h,v]bar->setSingleStep)
+ // We can't use the device specific QWheelEvent::pixelDelta(), so we calculate
+ // a pixel delta based on ticks and scroll per line.
static const float cDefaultQtScrollStep = 20.f;
webEvent.deltaX = webEvent.wheelTicksX * wheelScrollLines * cDefaultQtScrollStep;