summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qabstractslider.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2018-11-30 16:53:12 +0100
committerMitch Curtis <mitch.curtis@qt.io>2018-12-13 10:46:22 +0000
commit32fd79a20fb9b99913bba1537067f5dc8dd96a38 (patch)
tree6ee3569542e71a647360d609116da007e685cbcf /src/widgets/widgets/qabstractslider.cpp
parent35602d75d37af5ffee41d78f8876506ce2c188bf (diff)
QAbstractSlider: fix invertedControls having no effect for left/right keys
There was a comment in the code that said: // It seems we need to use invertedAppearance for Left and right, otherwise, things look weird. It's not clear what that was referring to, but in its current state, a slider with invertedControls set to true will not behave as expected: pressing the left arrow key will decrease its value instead of increasing it, and vice versa for the right arrow key. As stated in the documentation (and by its name), invertedAppearance only controls the appearance of the slider, and not the effect of key events. Remove the comment and use invertedControls instead. Change-Id: I13296cbda9244413978ef0d7f0856065f74fd0bf Fixes: QTBUG-25988 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/widgets/qabstractslider.cpp')
-rw-r--r--src/widgets/widgets/qabstractslider.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp
index 99ee1eccb7..2172ebc99c 100644
--- a/src/widgets/widgets/qabstractslider.cpp
+++ b/src/widgets/widgets/qabstractslider.cpp
@@ -829,7 +829,6 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
break;
#endif
- // It seems we need to use invertedAppearance for Left and right, otherwise, things look weird.
case Qt::Key_Left:
#ifdef QT_KEYPAD_NAVIGATION
// In QApplication::KeypadNavigationDirectional, we want to change the slider
@@ -848,9 +847,9 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
else
#endif
if (isRightToLeft())
- action = d->invertedAppearance ? SliderSingleStepSub : SliderSingleStepAdd;
+ action = d->invertedControls ? SliderSingleStepSub : SliderSingleStepAdd;
else
- action = !d->invertedAppearance ? SliderSingleStepSub : SliderSingleStepAdd;
+ action = !d->invertedControls ? SliderSingleStepSub : SliderSingleStepAdd;
break;
case Qt::Key_Right:
#ifdef QT_KEYPAD_NAVIGATION
@@ -868,9 +867,9 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev)
else
#endif
if (isRightToLeft())
- action = d->invertedAppearance ? SliderSingleStepAdd : SliderSingleStepSub;
+ action = d->invertedControls ? SliderSingleStepAdd : SliderSingleStepSub;
else
- action = !d->invertedAppearance ? SliderSingleStepAdd : SliderSingleStepSub;
+ action = !d->invertedControls ? SliderSingleStepAdd : SliderSingleStepSub;
break;
case Qt::Key_Up:
#ifdef QT_KEYPAD_NAVIGATION