summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-03-21 19:01:01 +0100
committerUlf Hermann <ulf.hermann@qt.io>2017-05-10 07:50:12 +0000
commitdfc74f42d339e94617900447437d15cbaf08b08e (patch)
treee7f4056df525d6ed455c416f7b9c234cb3ba63fd
parenta218356f838c4be8aad8f447e8d6187a8af639ff (diff)
downloadqtquickcontrols-dfc74f42d339e94617900447437d15cbaf08b08e.tar.gz
Slider: Don't suppress updates by dragThreshold on non-touchscreens
When using a mouse, you want a slider to react immediately to input, not only if you move beyond a certain threshold. With the threshold it is very hard to accurately position the slider. On touchscreens, the threshold is necessary to allow for unrelated events, like flicking views, to not interfere with the value. Change-Id: I6cb8252338f20de559e062e738118593ffc1e099 Task-number: QTBUG-47081 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--src/controls/Slider.qml2
-rw-r--r--tests/auto/controls/data/tst_slider.qml2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index bf54e93e..a90bc022 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -264,7 +264,7 @@ Control {
onPositionChanged: {
if (pressed)
- updateHandlePosition(mouse, preventStealing)
+ updateHandlePosition(mouse, !Settings.hasTouchScreen || preventStealing)
var point = mouseArea.mapToItem(fakeHandle, mouse.x, mouse.y)
handleHovered = fakeHandle.contains(Qt.point(point.x, point.y))
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index 1d7e92d2..0eec7e34 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -339,7 +339,7 @@ Item {
// drag less than the threshold distance
mouseMove(control, pt.x + Settings.dragThreshold - 1, pt.y)
- compare(control.value, 0.5)
+ verify(control.value > 0.5)
// drag over the threshold
mouseMove(control, pt.x + Settings.dragThreshold + 1, pt.y)