From 7501d55ae005cf9a155a6bcbeac468bfde40177d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 5 Oct 2012 10:42:10 +0200 Subject: Introduce (private) QStyleAnimation QStyleAnimation handles style animations in a generic fashion by sending StyleAnimationUpdate events back to the animation target instead of calling QWidget::update() directly. This decouples style animations from widgets and makes it possible to run style animations for QQuickItems (ie. the desktop components). The next step is to add "QObject* QStyleOption::target" and use that everywhere instead of the widget pointer passed to various QStyle methods. Change-Id: Ib963c54872805fc3f0123ff922f82c9962a68b90 Reviewed-by: J-P Nurmi Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qcleanlooksstyle.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/widgets/styles/qcleanlooksstyle.cpp') diff --git a/src/widgets/styles/qcleanlooksstyle.cpp b/src/widgets/styles/qcleanlooksstyle.cpp index 99e4b179f4..896f2ead32 100644 --- a/src/widgets/styles/qcleanlooksstyle.cpp +++ b/src/widgets/styles/qcleanlooksstyle.cpp @@ -67,6 +67,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -1759,9 +1760,11 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o } else { Q_D(const QCleanlooksStyle); int slideWidth = ((rect.width() - 4) * 2) / 3; - int step = ((d->animateStep * slideWidth) / d->animationFps) % slideWidth; - if ((((d->animateStep * slideWidth) / d->animationFps) % (2 * slideWidth)) >= slideWidth) - step = slideWidth - step; + int step = 0; +#ifndef QT_NO_ANIMATION + if (QProgressStyleAnimation *animation = qobject_cast(d->animation(widget))) + step = animation->progressStep(slideWidth); +#endif progressBar.setRect(rect.left() + 1 + step, rect.top() + 1, slideWidth / 2, rect.height() - 3); } -- cgit v1.2.3