Commit 8e8b0dba authored by J-P Nurmi's avatar J-P Nurmi
Browse files

Slider: don't clamp to the initial press point


Change-Id: I5115bbab670f534dae44eb19c2208aff21293889
Reviewed-by: default avatarMitch Curtis <mitch.curtis@digia.com>
parent a8532793
Branches
Tags
No related merge requests found
Showing with 26 additions and 1 deletion
......@@ -258,7 +258,7 @@ Control {
onPositionChanged: {
if (pressed)
updateHandlePosition(mouse)
updateHandlePosition(mouse, preventStealing)
var point = mouseArea.mapToItem(fakeHandle, mouse.x, mouse.y)
handleHovered = fakeHandle.contains(Qt.point(point.x, point.y))
......
......@@ -41,6 +41,8 @@
import QtQuick 2.2
import QtTest 1.0
import QtQuickControlsTests 1.0
import QtQuick.Controls 1.2
import QtQuick.Controls.Private 1.0
Item {
id: container
......@@ -305,5 +307,28 @@ Item {
compare(slider.__handlePos, 50)
slider.destroy()
}
function test_dragThreshold() {
var control = Qt.createQmlObject('import QtQuick.Controls 1.2; Slider {x: 20; y: 20; width: 100; height: 50}', container, '')
var pt = { x: control.width/2, y: control.height/2 }
mousePress(control, pt.x, pt.y)
compare(control.value, 0.5)
// drag less than the threshold distance
mouseMove(control, pt.x + Settings.dragThreshold - 1, pt.y)
compare(control.value, 0.5)
// drag over the threshold
mouseMove(control, pt.x + Settings.dragThreshold + 1, pt.y)
verify(control.value > 0.5)
// move back close to the original press point, less than the threshold distance away
mouseMove(control, pt.x - Settings.dragThreshold / 2, pt.y)
verify(control.value < 0.5)
control.destroy()
}
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment