Commit 99d3c341 authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen Committed by Allan Sandfeld Jensen
Browse files

Use angleDelta instead of deprecated Qt4 delta


Switch to using the Qt5 angleDelta instead of the Qt4 style delta that
can only handle single orientation wheel events.

Change-Id: I181dda03c7fc9c676100cb31ab7717f9641b625e
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@qt.io>
Showing with 4 additions and 7 deletions
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment