aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickrangeslider.cpp
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2021-12-01 12:57:40 +0100
committerIvan Solovev <ivan.solovev@qt.io>2021-12-02 12:51:44 +0100
commit7ff266ff782b35817d3ecc1a08c3a54bd2c2aa88 (patch)
tree6fd36932fbd51b81d2cadd66e360624ae0993b0a /src/quicktemplates2/qquickrangeslider.cpp
parent670cd949d3ec3700379cc40cd7d82d7e6f3a201b (diff)
RangeSlider: update handle positions when 'from' or 'to' value is changed
The RangeSlider's setTo() and setFrom() implementation was not updating the positions of the handles. This patch fixes it and aligns the behavior with the basic Slider. Fixes: QTBUG-98482 Pick-to: 5.15 6.2 Change-Id: I482c416f91be2b97af1d922305dfe6fc1f5bd573 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickrangeslider.cpp')
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp
index c006dda7cf..539a29b83f 100644
--- a/src/quicktemplates2/qquickrangeslider.cpp
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -679,6 +679,10 @@ void QQuickRangeSlider::setFrom(qreal from)
if (isComponentComplete()) {
d->first->setValue(d->first->value());
d->second->setValue(d->second->value());
+ auto *firstPrivate = QQuickRangeSliderNodePrivate::get(d->first);
+ auto *secondPrivate = QQuickRangeSliderNodePrivate::get(d->second);
+ firstPrivate->updatePosition(true);
+ secondPrivate->updatePosition();
}
}
@@ -707,6 +711,10 @@ void QQuickRangeSlider::setTo(qreal to)
if (isComponentComplete()) {
d->first->setValue(d->first->value());
d->second->setValue(d->second->value());
+ auto *firstPrivate = QQuickRangeSliderNodePrivate::get(d->first);
+ auto *secondPrivate = QQuickRangeSliderNodePrivate::get(d->second);
+ firstPrivate->updatePosition(true);
+ secondPrivate->updatePosition();
}
}