diff options
-rw-r--r-- | src/controls/Slider.qml | 4 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_slider.qml | 15 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index a90bc022..aa5fe07e 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -177,10 +177,10 @@ Control { /*! \internal The extra arguments positionAtMinimum and positionAtMaximum are there to force re-evaluation of the handle position when the constraints change (QTBUG-41255), - and the same for range.minimumValue (QTBUG-51765). + and the same for range.minimumValue (QTBUG-51765) and range.maximumValue (QTBUG-63354). */ property real __handlePos: range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y, - range.positionAtMinimum, range.positionAtMaximum, range.minimumValue) + range.positionAtMinimum, range.positionAtMaximum, range.minimumValue, range.maximumValue) activeFocusOnTab: true diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml index 0eec7e34..34627daa 100644 --- a/tests/auto/controls/data/tst_slider.qml +++ b/tests/auto/controls/data/tst_slider.qml @@ -392,7 +392,7 @@ Item { } } - function test_minimumValueLargerThanValue() { + function test_minimumMaximumValueLargerThanValue() { var control = sliderComponent.createObject(container, { "style": namedHandleStyle, "minimumValue": 0, "maximumValue": 2, value: "minimumValue" }); verify(control); @@ -405,6 +405,19 @@ Item { compare(control.value, control.minimumValue); compare(handle.mapToItem(null, 0, 0).x, 0) + control.maximumValue = 5; + control.value = 5; + compare(control.value, 5); + + // get the slider position at max + var maxPos = handle.mapToItem(null, 0, 0).x; + + // reduce the maximum value, resulting in the value becoming 4 as well + control.maximumValue = 4; + compare(control.value, 4); + // make sure that the actual position of the handle is the same (it used to be off - see QTBUG-63354) + compare(handle.mapToItem(null, 0, 0).x, maxPos); + control.destroy(); } } |