From 1505508742ba2077c2de6591f087b5144715c9ed Mon Sep 17 00:00:00 2001 From: Tero Ahola Date: Fri, 11 Nov 2011 09:22:43 +0100 Subject: Repaint QProgressBar when minimum or maximum changed The implementation of QProgressBar::setMinimum and setMaximum did not repaint the widget. This caused the widget to be shown incorrectly in case you call setMinimum or setMaximum but not setValue. Task-number: QTBUG-22121 (cherry picked from commit b1998f4f59c3b10700963b2d13a17a0cc77ef665) Reviewed-by: Friedemann Kleint Change-Id: I331d37ab4451d9e096cdf91a9e0a0286bc3cdffb Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qprogressbar.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp index 1ae55c50bc..3db91a6b6e 100644 --- a/src/widgets/widgets/qprogressbar.cpp +++ b/src/widgets/widgets/qprogressbar.cpp @@ -341,11 +341,17 @@ int QProgressBar::value() const void QProgressBar::setRange(int minimum, int maximum) { Q_D(QProgressBar); - d->minimum = minimum; - d->maximum = qMax(minimum, maximum); - if ( d->value <(d->minimum-1) || d->value > d->maximum) - reset(); + if (minimum != d->minimum || maximum != d->maximum) { + d->minimum = minimum; + d->maximum = qMax(minimum, maximum); + + if (d->value < (d->minimum - 1) || d->value > d->maximum) + reset(); + else + update(); + } } + /*! \property QProgressBar::textVisible \brief whether the current completed percentage should be displayed -- cgit v1.2.3