summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-12-01 15:55:44 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-12-01 18:52:32 (GMT)
commit537bff8c020c8fd2c150b2821d1cc035ee96f84f (patch)
tree743f91e9e46d70b9dcf9bc7cb38b8e35dbc37ca9 /src/gui
parent2d470839354e022840d5e7d0f9772a23544a696e (diff)
downloadQt-537bff8c020c8fd2c150b2821d1cc035ee96f84f.zip
Qt-537bff8c020c8fd2c150b2821d1cc035ee96f84f.tar.gz
Qt-537bff8c020c8fd2c150b2821d1cc035ee96f84f.tar.bz2
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')
-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 30f2f35..0a59d6d 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;