From 9e49e6039574898f73523cbcd8f6080ec6ad31e3 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 3 Jan 2017 11:37:33 +0100 Subject: Account for when the wheel event is inverted On macOS, the vertical scrolling with the wheel may be inverted, so we need to account for this when getting the y angle. Change-Id: Ie66b6ae68d2c733aaae5a837fc6f1a758a66cfb9 Reviewed-by: J-P Nurmi --- src/quicktemplates2/qquickslider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp index c0680725..608e0d14 100644 --- a/src/quicktemplates2/qquickslider.cpp +++ b/src/quicktemplates2/qquickslider.cpp @@ -572,7 +572,7 @@ void QQuickSlider::wheelEvent(QWheelEvent *event) if (d->wheelEnabled) { const qreal oldValue = d->value; const QPointF angle = event->angleDelta(); - const qreal delta = (qFuzzyIsNull(angle.y()) ? angle.x() : angle.y()) / QWheelEvent::DefaultDeltasPerStep; + const qreal delta = (qFuzzyIsNull(angle.y()) ? angle.x() : (event->inverted() ? -angle.y() : angle.y())) / QWheelEvent::DefaultDeltasPerStep; const qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize; setValue(oldValue + step * delta); event->setAccepted(!qFuzzyCompare(d->value, oldValue)); -- cgit v1.2.3