diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-06-27 16:52:21 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-06-27 16:52:35 +0200 |
commit | ec5a99b0515779ff5ec3df6bd657127b4e037823 (patch) | |
tree | c5dc52e8892b6740123469276dcb303a81d9fd56 /src/core/web_event_factory.cpp | |
parent | 56bea56b2d8fabc4b09d41531177a22d9297ce2c (diff) | |
parent | 722732d1f089630ad517aef8f94325a51186b274 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ic6686df8f82f710a3441501b7eeaffe69fbcbdf7
Diffstat (limited to 'src/core/web_event_factory.cpp')
-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 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; |