summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2014-11-04 17:27:28 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2014-11-05 11:06:13 +0100
commitaa510d9ac0bd1ecab6baa260d3ff5f2a64eb3acf (patch)
tree306c971b91afdc67b2bb8c1cc86105c539e0c065
parent74b05b5c86637dcbdcd42320e8f27794fff9f93f (diff)
downloadqtquickcontrols-aa510d9ac0bd1ecab6baa260d3ff5f2a64eb3acf.tar.gz
Slider: fix tap-to-set-value on touch screens
Change-Id: I7784b3a8266f889bc2079da4c64096eb9d50d6f5 Task-number: QTBUG-42252 Reviewed-by: Caroline Chao <caroline.chao@theqtcompany.com>
-rw-r--r--src/controls/Slider.qml9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index b06fcf3a..d43923c1 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -237,21 +237,21 @@ Control {
return Math.max(range.positionAtMinimum, Math.min(range.positionAtMaximum, val))
}
- function updateHandlePosition(mouse) {
+ function updateHandlePosition(mouse, force) {
var pos, overThreshold
if (__horizontal) {
pos = clamp (mouse.x + clickOffset - fakeHandle.width/2)
overThreshold = Math.abs(mouse.x - pressX) >= Settings.dragThreshold
if (overThreshold)
preventStealing = true
- if (overThreshold || !Settings.hasTouchScreen)
+ if (overThreshold || force)
fakeHandle.x = pos
} else if (!__horizontal) {
pos = clamp (mouse.y + clickOffset- fakeHandle.height/2)
overThreshold = Math.abs(mouse.y - pressY) >= Settings.dragThreshold
if (overThreshold)
preventStealing = true
- if (overThreshold || !Settings.hasTouchScreen)
+ if (overThreshold || force)
fakeHandle.y = pos
}
}
@@ -274,10 +274,11 @@ Control {
}
pressX = mouse.x
pressY = mouse.y
- updateHandlePosition(mouse)
+ updateHandlePosition(mouse, !Settings.hasTouchScreen)
}
onReleased: {
+ updateHandlePosition(mouse, Settings.hasTouchScreen)
// If we don't update while dragging, this is the only
// moment that the range is updated.
if (!slider.updateValueWhileDragging)