From 314a05debe668cf0a17991121401e93fb846adf6 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 5 Jan 2017 09:24:08 +0100 Subject: QQuickDial: 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: Ia0f59beba905beff7b0cf12271a654c721bd5179 Reviewed-by: Andy Shaw --- src/quicktemplates2/qquickdial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quicktemplates2') diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp index 2b9f83a4..04f4eda5 100644 --- a/src/quicktemplates2/qquickdial.cpp +++ b/src/quicktemplates2/qquickdial.cpp @@ -613,7 +613,7 @@ void QQuickDial::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