summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2017-01-03 11:37:33 +0100
committerAndy Shaw <andy.shaw@qt.io>2017-01-04 06:51:22 +0000
commit9e49e6039574898f73523cbcd8f6080ec6ad31e3 (patch)
tree6a044325ea3a7a0eeb92991464a52500edec189b
parentd3aa51f4b7f1c5b68f1f0011a8e9fb32ec3672b6 (diff)
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 <jpnurmi@qt.io>
-rw-r--r--src/quicktemplates2/qquickslider.cpp2
1 files changed, 1 insertions, 1 deletions
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));