aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-26 14:53:30 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-27 12:35:17 +0100
commit092553dc514c0220a8a3abf2e9b0b6d6f9828315 (patch)
tree9a06d76ccbc0c16d1d7a3b76829ed751a3c75612
parent1569a601f265390502ea492a0bc68fd4ff88dd20 (diff)
nativestyle, slider: ensure that we set correct slider positionHEADdev
slider.position is a number between 0 and 1. And when the position is 1, styleOption.sliderPosition should be equal to styleOption.maximum. So no reason to subtract "min" (which is also not a normalized number). Change-Id: I9f9ff2e112e224b3aa32bda12aa1963a6e74c6ca Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
-rw-r--r--src/imports/nativestyle/items/qquickstyleitemslider.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/imports/nativestyle/items/qquickstyleitemslider.cpp b/src/imports/nativestyle/items/qquickstyleitemslider.cpp
index bc986522..6f8ec31f 100644
--- a/src/imports/nativestyle/items/qquickstyleitemslider.cpp
+++ b/src/imports/nativestyle/items/qquickstyleitemslider.cpp
@@ -89,7 +89,6 @@ void QQuickStyleItemSlider::initStyleOption(QStyleOptionSlider &styleOption)
if (slider->isPressed())
styleOption.state |= QStyle::State_Sunken;
-
qreal min = 0;
qreal max = 1;
if (!qFuzzyIsNull(slider->stepSize())) {
@@ -116,5 +115,5 @@ void QQuickStyleItemSlider::initStyleOption(QStyleOptionSlider &styleOption)
styleOption.minimum = 0;
styleOption.maximum = int(Scale);
styleOption.sliderValue = int((slider->value() - min) * normalizeMultiplier);
- styleOption.sliderPosition = int((slider->position() - min) * normalizeMultiplier);
+ styleOption.sliderPosition = int(slider->position() * styleOption.maximum);
}