summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qwindowsstyle.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-12-01 16:55:44 +0100
committerOlivier Goffart <ogoffart@trolltech.com>2009-12-01 19:52:32 +0100
commit537bff8c020c8fd2c150b2821d1cc035ee96f84f (patch)
tree743f91e9e46d70b9dcf9bc7cb38b8e35dbc37ca9 /src/gui/styles/qwindowsstyle.cpp
parent2d470839354e022840d5e7d0f9772a23544a696e (diff)
QWindowStyle: make sure there is no duplicate in the list of scrollbar.
Otherwise the list grow and waste memory and CPU each time the stylesheet is changed or the widget is shown Reviewed-by: Thierry Task-number: QTBUG-6409
Diffstat (limited to 'src/gui/styles/qwindowsstyle.cpp')
-rw-r--r--src/gui/styles/qwindowsstyle.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 30f2f35af6..0a59d6d388 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -213,10 +213,12 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)
case QEvent::StyleChange:
case QEvent::Show:
if (QProgressBar *bar = qobject_cast<QProgressBar *>(o)) {
- d->bars << bar;
- if (d->bars.size() == 1) {
- Q_ASSERT(d->animationFps> 0);
- d->animateTimer = startTimer(1000 / d->animationFps);
+ if (!d->bars.contains(bar)) {
+ d->bars << bar;
+ if (d->bars.size() == 1) {
+ Q_ASSERT(d->animationFps> 0);
+ d->animateTimer = startTimer(1000 / d->animationFps);
+ }
}
}
break;