aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-04-14 14:33:53 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-04-14 12:35:46 +0000
commite7c51fcb3df76ddb640666647bdc535005f56b30 (patch)
tree0a745edd155ad15a9e8d882d1ac48c4a7e2227fb
parent52c33410d209f0c540d649c1fdf690f4c8d0a1d0 (diff)
Fix vertical Slider
Change-Id: Idaa1416bdc09ad2ff469f7ddebcf8212bdeb1b2c Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r--src/controls/qquickslider.cpp2
-rw-r--r--src/imports/controls/Slider.qml9
2 files changed, 6 insertions, 5 deletions
diff --git a/src/controls/qquickslider.cpp b/src/controls/qquickslider.cpp
index a55b5c9d..551ba0d6 100644
--- a/src/controls/qquickslider.cpp
+++ b/src/controls/qquickslider.cpp
@@ -101,7 +101,7 @@ qreal QQuickSliderPrivate::positionAt(const QPoint &point) const
const qreal offset = hh / 2;
const qreal extent = q->height() - hh;
if (!qFuzzyIsNull(extent))
- return (point.y() - offset) / extent;
+ return 1.0 - (point.y() - offset) / extent;
}
return 0;
}
diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml
index 16d33613..3c9c406b 100644
--- a/src/imports/controls/Slider.qml
+++ b/src/imports/controls/Slider.qml
@@ -78,6 +78,7 @@ AbstractSlider {
}
track: Rectangle {
+ id: track
readonly property bool horizontal: control.orientation === Qt.Horizontal
implicitWidth: horizontal ? 120 : 6
implicitHeight: horizontal ? 6 : 120
@@ -89,13 +90,13 @@ AbstractSlider {
radius: control.Theme.roundness
border.color: control.Theme.frameColor
color: control.Theme.backgroundColor
- scale: control.effectiveLayoutDirection === Qt.RightToLeft ? -1 : 1
+ scale: horizontal && control.effectiveLayoutDirection === Qt.RightToLeft ? -1 : 1
Rectangle {
x: 2
- y: 2
- width: control.position * parent.width - 4
- height: 2
+ y: track.horizontal ? 2 : control.visualPosition * parent.height + 2
+ width: track.horizontal ? control.position * parent.width - 4 : 2
+ height: track.horizontal ? 2 : control.position * parent.height - 4
color: control.Theme.accentColor
radius: control.Theme.roundness