summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstylesheetstyle.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2012-10-16 16:35:34 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-17 20:47:08 +0200
commita98b9435579f5abef82036e81af4488d8a464b66 (patch)
treed647030face0d45f51c39f9c56ad77574871f4fe /src/widgets/styles/qstylesheetstyle.cpp
parent037d1e18e39f24b8ebb2772c20444d4b44cfb12b (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/qstylesheetstyle.cpp')
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 068b7a4355..d73d25a1af 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -69,7 +69,6 @@
#include <qcheckbox.h>
#include <qstatusbar.h>
#include <qheaderview.h>
-#include <qprogressbar.h>
#include <private/qwindowsstyle_p.h>
#include <private/qstyleanimation_p.h>
#include <qtabbar.h>
@@ -2726,12 +2725,6 @@ void QStyleSheetStyle::polish(QWidget *w)
}
#endif
-#ifndef QT_NO_PROGRESSBAR
- if (QProgressBar *pb = qobject_cast<QProgressBar *>(w)) {
- QWindowsStyle::polish(pb);
- }
-#endif
-
QRenderRule rule = renderRule(w, PseudoElement_None, PseudoClass_Any);
if (rule.hasDrawable() || rule.hasBox()) {
if (w->metaObject() == &QWidget::staticMetaObject
@@ -2826,10 +2819,6 @@ void QStyleSheetStyle::unpolish(QWidget *w)
sa, SLOT(update()));
}
#endif
-#ifndef QT_NO_PROGRESSBAR
- if (QProgressBar *pb = qobject_cast<QProgressBar *>(w))
- QWindowsStyle::unpolish(pb);
-#endif
baseStyle()->unpolish(w);
}
@@ -3830,14 +3819,14 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
}
QRect r = rect;
+ Q_D(const QWindowsStyle);
if (pb->minimum == 0 && pb->maximum == 0) {
- Q_D(const QWindowsStyle);
int chunkCount = fillWidth/chunkWidth;
int offset = 0;
-#ifndef QT_NO_ANIMATION
- if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(w)))
+ if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(opt->styleObject)))
offset = animation->animationStep() * 8 % rect.width();
-#endif
+ else
+ d->startAnimation(new QProgressStyleAnimation(d->animationFps, opt->styleObject));
int x = reverse ? r.left() + r.width() - offset - chunkWidth : r.x() + offset;
while (chunkCount > 0) {
r.setRect(x, rect.y(), chunkWidth, rect.height());
@@ -3868,6 +3857,8 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
subRule.drawRule(p, r);
x += reverse ? -chunkWidth : chunkWidth;
}
+
+ d->stopAnimation(opt->styleObject);
}
p->restore();