diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-06-23 09:53:26 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@digia.com> | 2014-06-23 11:42:01 +0200 |
commit | f433dbf758c5d7159b4b0431f819214c804424d0 (patch) | |
tree | 1267b0ce4e3d6ed2786c4989f82f447b3c2a68f9 /src/controls/Slider.qml | |
parent | 266fab2a8920dc79e52555b81cf1708233c1b60f (diff) | |
download | qtquickcontrols-f433dbf758c5d7159b4b0431f819214c804424d0.tar.gz |
Slider: fix behavior inside a flickable on touch
Do not move the handle immediately on press, but delay it until the
drag is over the threshold. This makes Slider behave inside a flickable
in a sensible way ie. the handle is not prematurely moved when flicking
Change-Id: Ie02762717156e75be9db757330a95a3f50451f1a
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/controls/Slider.qml')
-rw-r--r-- | src/controls/Slider.qml | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index ffea986c..0f7fc033 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -229,18 +229,22 @@ Control { onMouseXChanged: { if (pressed && __horizontal) { var pos = clamp (mouse.x + clickOffset - fakeHandle.width/2) - fakeHandle.x = pos - if (Math.abs(mouse.x - pressX) >= Settings.dragThreshold) + var overThreshold = Math.abs(mouse.x - pressX) >= Settings.dragThreshold + if (overThreshold) preventStealing = true + if (overThreshold || !Settings.hasTouchScreen) + fakeHandle.x = pos } } onMouseYChanged: { if (pressed && !__horizontal) { var pos = clamp (mouse.y + clickOffset- fakeHandle.height/2) - fakeHandle.y = pos - if (Math.abs(mouse.y - pressY) >= Settings.dragThreshold) + var overThreshold = Math.abs(mouse.y - pressY) >= Settings.dragThreshold + if (overThreshold) preventStealing = true + if (overThreshold || !Settings.hasTouchScreen) + fakeHandle.y = pos } } |