diff options
author | Tero Ahola <tero.ahola@digia.com> | 2011-11-10 15:40:47 (GMT) |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-11-10 15:40:47 (GMT) |
commit | b1998f4f59c3b10700963b2d13a17a0cc77ef665 (patch) | |
tree | 0a3d0ed1c9de3c76ef4b635aefd4cea6f8580a64 /src | |
parent | 72e61b127470b044e370af7017fa8a5b0538244f (diff) | |
download | Qt-b1998f4f59c3b10700963b2d13a17a0cc77ef665.zip Qt-b1998f4f59c3b10700963b2d13a17a0cc77ef665.tar.gz Qt-b1998f4f59c3b10700963b2d13a17a0cc77ef665.tar.bz2 |
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
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qprogressbar.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/widgets/qprogressbar.cpp b/src/gui/widgets/qprogressbar.cpp index 1b0a1a1..c583a78 100644 --- a/src/gui/widgets/qprogressbar.cpp +++ b/src/gui/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 |