diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-22 11:22:43 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-26 12:38:20 +0200 |
commit | 35c11e02e01d19e1184a97be7e7aba9b1b936b79 (patch) | |
tree | 2da82574abaef801cf55cc26c87baa0e5d9fc15e /src/controls/Slider.qml | |
parent | e6e7f37afd21a2f5224db367159801d20088d99d (diff) | |
download | qtquickcontrols-35c11e02e01d19e1184a97be7e7aba9b1b936b79.tar.gz |
Fix Slider increments on keypress
Instead of always adding/subtracting 1/10 of the range use the step size when
the arrow keys are pressed. In addition add accessible actions to inc/dec the value.
Task-number: QTBUG-39099
Change-Id: I4fdf2adc8912ab1fa8838be56af4e798eeb59781
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Diffstat (limited to 'src/controls/Slider.qml')
-rw-r--r-- | src/controls/Slider.qml | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index ffea986c..2838ed7e 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -177,13 +177,21 @@ Control { activeFocusOnTab: true Accessible.role: Accessible.Slider + /*! \internal */ + function accessibleIncreaseAction() { + range.increaseSingleStep() + } + /*! \internal */ + function accessibleDecreaseAction() { + range.decreaseSingleStep() + } style: Qt.createComponent(Settings.style + "/SliderStyle.qml", slider) - Keys.onRightPressed: if (__horizontal) value += (maximumValue - minimumValue)/10.0 - Keys.onLeftPressed: if (__horizontal) value -= (maximumValue - minimumValue)/10.0 - Keys.onUpPressed: if (!__horizontal) value += (maximumValue - minimumValue)/10.0 - Keys.onDownPressed: if (!__horizontal) value -= (maximumValue - minimumValue)/10.0 + Keys.onRightPressed: if (__horizontal) range.increaseSingleStep() + Keys.onLeftPressed: if (__horizontal) range.decreaseSingleStep() + Keys.onUpPressed: if (!__horizontal) range.increaseSingleStep() + Keys.onDownPressed: if (!__horizontal) range.decreaseSingleStep() RangeModel { id: range |