summaryrefslogtreecommitdiffstats
path: root/src/corelib/animation/qsequentialanimationgroup.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-02-11 15:14:34 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-02-14 16:24:40 +0000
commite812358ba8570823e4d600561d45361c2edaaa3b (patch)
tree8ea3b74a1994276ed45466ce0ffac6702a622ae5 /src/corelib/animation/qsequentialanimationgroup.cpp
parent4dd7aeee10fc4d3883fd26fd70662405b533b6b4 (diff)
Animation classes: micro-optimize loops.
Don't use index-based iteration, but use iterators assigning end() to a variable. Change-Id: Ia87532349855fa3baa748b62224fc8adf3395dc0 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/animation/qsequentialanimationgroup.cpp')
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 059d62bdca..5a0982019f 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -81,6 +81,8 @@
QT_BEGIN_NAMESPACE
+typedef QList<QAbstractAnimation *>::ConstIterator AnimationListConstIt;
+
bool QSequentialAnimationGroupPrivate::atEnd() const
{
// we try to detect if we're at the end of the group
@@ -310,9 +312,8 @@ int QSequentialAnimationGroup::duration() const
Q_D(const QSequentialAnimationGroup);
int ret = 0;
- for (int i = 0; i < d->animations.size(); ++i) {
- QAbstractAnimation *animation = d->animations.at(i);
- const int currentDuration = animation->totalDuration();
+ for (AnimationListConstIt it = d->animations.constBegin(), cend = d->animations.constEnd(); it != cend; ++it) {
+ const int currentDuration = (*it)->totalDuration();
if (currentDuration == -1)
return -1; // Undetermined length