Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.15.1, 6.2.1
-
7ff266ff782b35817d3ecc1a08c3a54bd2c2aa88 (qt/qtdeclarative/dev) 29dfaa92b9d56f5555b511756f5b8ee62aabc0bf (qt/tqtc-qtquickcontrols2/5.15) fd3c67b18318edfbe0a7737e8be1081a775e12df (qt/qtdeclarative/6.2)
Description
When we changed from (or to) property of RangeSlider{}, position and visualPosition were not dynamically changed.
Please see the attached example.
IMHO, we need to call updatePosition() in QQuickRangeSlider::setFrom() and
QQuickRangeSlider::setTo() like this (it's a just test code)
shko@shko ~/work/qt_src/qt5/qtquickcontrols2 ((HEAD detached at c0daab494))$ git diff . diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp index 9ad12102e..cefbe5159 100644 --- a/src/quicktemplates2/qquickrangeslider.cpp +++ b/src/quicktemplates2/qquickrangeslider.cpp @@ -662,6 +662,11 @@ void QQuickRangeSlider::setFrom(qreal from) if (isComponentComplete()) { d->first->setValue(d->first->value()); d->second->setValue(d->second->value()); + + QQuickRangeSliderNodePrivate *firstPrivate = QQuickRangeSliderNodePrivate::get(d->first); + QQuickRangeSliderNodePrivate *secondPrivate = QQuickRangeSliderNodePrivate::get(d->second); + firstPrivate->updatePosition(); + secondPrivate->updatePosition(); } } @@ -690,6 +695,11 @@ void QQuickRangeSlider::setTo(qreal to) if (isComponentComplete()) { d->first->setValue(d->first->value()); d->second->setValue(d->second->value()); + + QQuickRangeSliderNodePrivate *firstPrivate = QQuickRangeSliderNodePrivate::get(d->first); + QQuickRangeSliderNodePrivate *secondPrivate = QQuickRangeSliderNodePrivate::get(d->second); + firstPrivate->updatePosition(); + secondPrivate->updatePosition(); } }
Even though there is a setValue() call in QQuickRangeSlider::setFrom() and QQuickRangeSlider::setTo(), updatePosition in setValue() will not be called because there is no value change.
Attachments
Issue Links
- is duplicated by
-
QTBUG-103379 QQuickRangeSlider doesn't update position of slider node
-
- Closed
-
For Gerrit Dashboard: QTBUG-98482 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
384085,5 | RangeSlider: update handle positions when 'from' or 'to' value is changed | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
384390,2 | RangeSlider: update handle positions when 'from' or 'to' value is changed | 6.2 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
384392,1 | RangeSlider: update handle positions when 'from' or 'to' value is changed | tqtc/lts-5.15 | qt/tqtc-qtdeclarative | Status: ABANDONED | 0 | 0 |
384419,2 | RangeSlider: update handle positions when 'from' or 'to' value is changed | tqtc/lts-5.15 | qt/tqtc-qtquickcontrols2 | Status: MERGED | +2 | 0 |