diff options
-rw-r--r-- | src/quicktemplates2/qquickdial.cpp | 6 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_dial.qml | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp index c7fbdc80..5b98992b 100644 --- a/src/quicktemplates2/qquickdial.cpp +++ b/src/quicktemplates2/qquickdial.cpp @@ -207,8 +207,6 @@ void QQuickDialPrivate::handlePress(const QPointF &point) void QQuickDialPrivate::handleMove(const QPointF &point) { Q_Q(QQuickDial); - if (!q->keepMouseGrab() && !q->keepTouchGrab()) - return; const qreal oldPos = position; qreal pos = positionAt(point); if (snapMode == QQuickDial::SnapAlways) @@ -651,6 +649,7 @@ void QQuickDial::mousePressEvent(QMouseEvent *event) Q_D(QQuickDial); QQuickControl::mousePressEvent(event); d->handlePress(event->localPos()); + d->handleMove(event->localPos()); } void QQuickDial::mouseMoveEvent(QMouseEvent *event) @@ -711,7 +710,8 @@ void QQuickDial::touchEvent(QTouchEvent *event) setKeepTouchGrab(overYDragThreshold); } } - d->handleMove(point.pos()); + if (keepTouchGrab()) + d->handleMove(point.pos()); } break; diff --git a/tests/auto/controls/data/tst_dial.qml b/tests/auto/controls/data/tst_dial.qml index 98c3a002..3b20e91d 100644 --- a/tests/auto/controls/data/tst_dial.qml +++ b/tests/auto/controls/data/tst_dial.qml @@ -465,7 +465,7 @@ TestCase { compare(dial.value, dial.to); } - function test_snapMode_data() { + function test_snapMode_data(immediate) { return [ { tag: "NoSnap", snapMode: Slider.NoSnap, from: 0, to: 2, values: [0, 0, 1], positions: [0, 0.5, 0.5] }, { tag: "SnapAlways (0..2)", snapMode: Slider.SnapAlways, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] }, @@ -474,13 +474,13 @@ TestCase { { tag: "SnapAlways (1..-1)", snapMode: Slider.SnapAlways, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] }, { tag: "SnapOnRelease (0..2)", snapMode: Slider.SnapOnRelease, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] }, { tag: "SnapOnRelease (1..3)", snapMode: Slider.SnapOnRelease, from: 1, to: 3, values: [1.0, 1.0, 2.0], positions: [0.0, 0.5, 0.5] }, - { tag: "SnapOnRelease (-1..1)", snapMode: Slider.SnapOnRelease, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [0.5, 0.5, 0.5] }, + { tag: "SnapOnRelease (-1..1)", snapMode: Slider.SnapOnRelease, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [immediate ? 0.0 : 0.5, 0.5, 0.5] }, { tag: "SnapOnRelease (1..-1)", snapMode: Slider.SnapOnRelease, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] } ] } function test_snapMode_mouse_data() { - return test_snapMode_data() + return test_snapMode_data(true) } function test_snapMode_mouse(data) { @@ -492,11 +492,11 @@ TestCase { dial.to = data.to; dial.stepSize = 0.2; - var fuzz = 0.05; + var fuzz = 0.055; mousePress(dial, dial.width * 0.25, dial.height * 0.75); - compare(dial.value, data.values[0]); - compare(dial.position, data.positions[0]); + fuzzyCompare(dial.value, data.values[0], fuzz); + fuzzyCompare(dial.position, data.positions[0], fuzz); mouseMove(dial, dial.width * 0.5, dial.height * 0.25); fuzzyCompare(dial.value, data.values[1], fuzz); @@ -508,7 +508,7 @@ TestCase { } function test_snapMode_touch_data() { - return test_snapMode_data() + return test_snapMode_data(false) } function test_snapMode_touch(data) { |