diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-22 11:19:32 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-22 11:29:58 (GMT) |
commit | 336954fb9b990c6d7c44ed3a8d676a6e21b2057f (patch) | |
tree | 3d29f3aae74abd76d24e19d98a1ac3f1d42638d3 /src/gui/styles/qcleanlooksstyle.cpp | |
parent | 3a8968dd2aab9c4e40ed34222f557bec6a98349e (diff) | |
download | Qt-336954fb9b990c6d7c44ed3a8d676a6e21b2057f.zip Qt-336954fb9b990c6d7c44ed3a8d676a6e21b2057f.tar.gz Qt-336954fb9b990c6d7c44ed3a8d676a6e21b2057f.tar.bz2 |
Simplify the computation of the QProgressBar progress.
This is also a work around for a bug in gcc on powerpc (embedded-linux)
Task-number: 258358
Reviewed-by: jbache
Diffstat (limited to 'src/gui/styles/qcleanlooksstyle.cpp')
-rw-r--r-- | src/gui/styles/qcleanlooksstyle.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 01f19c6..779fbc2 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -1745,10 +1745,9 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o int maxWidth = rect.width() - 4; int minWidth = 4; - qint64 progress = (qint64)qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar - double vc6_workaround = ((progress - qint64(bar->minimum)) / qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * maxWidth); - int progressBarWidth = (int(vc6_workaround) > minWidth ) ? int(vc6_workaround) : minWidth; - int width = indeterminate ? maxWidth : progressBarWidth; + int progress = qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar + int progressBarWidth = qMax(minWidth, (progress - bar->minimum) * maxWidth / qMax(1, bar->maximum - bar->minimum)); + int width = indeterminate ? maxWidth : progressBarWidth; bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical; if (inverted) |