diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2016-09-12 17:06:04 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2016-09-14 07:54:56 +0000 |
commit | 5d4e7366718d3784063bdf64725a5371355f179a (patch) | |
tree | 74bc2bc3e1b99009d9ea978e1bf9a7148156f46a /src | |
parent | 3aee127f969cabec0819d93d305d47afc4cf25d6 (diff) | |
download | qtquickcontrols-5d4e7366718d3784063bdf64725a5371355f179a.tar.gz |
Slider: fix the handle's position when minimumValue is not 0
__handlePos (badly named; it should be, e.g. __handleValueForPos)
represents the value of the handle based on "fakeHandle"'s position. It
is the result of range.valueForPosition() being called. However, the
arguments to this function (fakeHandle.x and fakeHandle.y) don't always
change when the values of the slider change, which leads to the x
calculation for the handle delegate in SliderStyle having outdated
information, causing the related bug.
The fix for another bug already works around this issue by passing the
relevant properties as arguments (which are ignored) to the function
call. This is presumably done this way because it should be cheaper
than forcing the JavaScript engine to evaluate a more clearly written
expression where each related property is on its own line, for example.
property real __handlePos: {
range.positionAtMinimum, range.positionAtMaximum;
return range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y);
}
In the case of the related bug, minimumValue has been updated, but
__handlePos is still using the old value, causing the handle to be
positioned incorrectly. So, we continue this tradition and add another
property to the list of arguments.
Task-number: QTBUG-51765
Change-Id: I40882872e668a867a8f5e5768244e199618bd769
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/controls/Slider.qml | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index 20d11025..981a619b 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -173,9 +173,11 @@ Control { /*! \internal The extra arguments positionAtMinimum and positionAtMaximum are there to force - re-evaluation of the handle position when the constraints change (QTBUG-41255). + re-evaluation of the handle position when the constraints change (QTBUG-41255), + and the same for range.minimumValue (QTBUG-51765). */ - property real __handlePos: range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y, range.positionAtMinimum, range.positionAtMaximum) + property real __handlePos: range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y, + range.positionAtMinimum, range.positionAtMaximum, range.minimumValue) activeFocusOnTab: true |