diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/web_event_factory.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index da230479a..80f81e954 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -656,14 +656,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; |