summaryrefslogtreecommitdiff
path: root/src/controls/Slider.qml
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@theqtcompany.com>2015-08-25 12:19:21 +0200
committerShawn Rutledge <shawn.rutledge@theqtcompany.com>2016-03-15 10:34:00 +0000
commita275fb3d29d5560af22ef5c4a721ce9bf2a2ccc1 (patch)
treef9111c918bacbf4dd1c2df6c5b98effe0514bacc /src/controls/Slider.qml
parent101c1c5e466befc8f58f2eca35265dd32ea9f66a (diff)
downloadqtquickcontrols-a275fb3d29d5560af22ef5c4a721ce9bf2a2ccc1.tar.gz
Correct scrolling direction when using Sliders
Account for OS X "direct"/"inverted"/"australian" scrolling. This ensures that a touchpad right/left/up/down flick will move the slider handle in the same direction as the flick. This takes advantage of the recent addition of QWheelEvent::inverted in qtbase Change-Id: If51ec6f0cbc12a042a92aa55964633c9521469a9 Task-number: QTBUG-35972 Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'src/controls/Slider.qml')
-rw-r--r--src/controls/Slider.qml4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index 1a34c049..f38db0e4 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -317,14 +317,14 @@ Control {
onVerticalWheelMoved: {
if (verticalDelta !== 0) {
var delta = Math.abs(verticalDelta)*step > stepSize ? verticalDelta*step : verticalDelta/Math.abs(verticalDelta)*stepSize
- value += delta
+ value -= delta * (inverted ? 1 : -1)
}
}
onHorizontalWheelMoved: {
if (horizontalDelta !== 0) {
var delta = Math.abs(horizontalDelta)*step > stepSize ? horizontalDelta*step : horizontalDelta/Math.abs(horizontalDelta)*stepSize
- value += delta
+ value += delta * (inverted ? 1 : -1)
}
}
}