aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickdial.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-12-01 13:59:53 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-12-01 13:59:53 +0100
commit4ba00f0054ffd183377fd420b35ef7a388c0bcfe (patch)
treedde076314b40ce0dd540e5363ff6d9fca98016f4 /src/quicktemplates2/qquickdial.cpp
parent948932c9c6ae535647e69962aad2add516802b9c (diff)
parentd8c5dea96fb8861089e2166ae574a85d2b69c09e (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: src/imports/controls/SpinBox.qml src/imports/controls/material/SpinBox.qml src/imports/controls/universal/SpinBox.qml tests/auto/controls/data/tst_swipedelegate.qml Change-Id: Ie1d1f487890f0a9f80a00df5e813e1d2e8303fe5
Diffstat (limited to 'src/quicktemplates2/qquickdial.cpp')
-rw-r--r--src/quicktemplates2/qquickdial.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp
index 2932f4ce..7bfc0487 100644
--- a/src/quicktemplates2/qquickdial.cpp
+++ b/src/quicktemplates2/qquickdial.cpp
@@ -657,6 +657,20 @@ void QQuickDial::mouseUngrabEvent()
setPressed(false);
}
+void QQuickDial::wheelEvent(QWheelEvent *event)
+{
+ Q_D(QQuickDial);
+ QQuickControl::wheelEvent(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 step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ setValue(oldValue + step * delta);
+ event->setAccepted(!qFuzzyCompare(d->value, oldValue));
+ }
+}
+
void QQuickDial::mirrorChange()
{
QQuickControl::mirrorChange();