diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2012-10-16 16:35:34 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-17 20:47:08 +0200 |
commit | a98b9435579f5abef82036e81af4488d8a464b66 (patch) | |
tree | d647030face0d45f51c39f9c56ad77574871f4fe /src/widgets/styles/qcleanlooksstyle.cpp | |
parent | 037d1e18e39f24b8ebb2772c20444d4b44cfb12b (diff) |
Styles: revise indeterminate progress bar animations
Remove dependencies to QProgressBar where possible. This makes
it possible to animate for example QQuickItem based progress
bars (read: the desktop components).
Change-Id: If208506702365895576238c24191b8d70b90841c
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/widgets/styles/qcleanlooksstyle.cpp')
-rw-r--r-- | src/widgets/styles/qcleanlooksstyle.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/widgets/styles/qcleanlooksstyle.cpp b/src/widgets/styles/qcleanlooksstyle.cpp index 896f2ead32..5b8b5e0b9f 100644 --- a/src/widgets/styles/qcleanlooksstyle.cpp +++ b/src/widgets/styles/qcleanlooksstyle.cpp @@ -1751,20 +1751,21 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o reverse = !reverse; QRect progressBar; + Q_D(const QCleanlooksStyle); if (!indeterminate) { if (!reverse) { progressBar.setRect(rect.left() + 1, rect.top() + 1, width + 1, rect.height() - 3); } else { progressBar.setRect(rect.right() - 1 - width, rect.top() + 1, width + 1, rect.height() - 3); } + d->stopAnimation(option->styleObject); } else { - Q_D(const QCleanlooksStyle); int slideWidth = ((rect.width() - 4) * 2) / 3; int step = 0; -#ifndef QT_NO_ANIMATION - if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(widget))) + if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(option->styleObject))) step = animation->progressStep(slideWidth); -#endif + else + d->startAnimation(new QProgressStyleAnimation(d->animationFps, option->styleObject)); progressBar.setRect(rect.left() + 1 + step, rect.top() + 1, slideWidth / 2, rect.height() - 3); } |