| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/animation/qparallelanimationgroup.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||
| 2 | ** | - | ||||||||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||
| 5 | ** | - | ||||||||||||
| 6 | ** This file is part of the QtCore module of the Qt Toolkit. | - | ||||||||||||
| 7 | ** | - | ||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||
| 16 | ** | - | ||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||
| 25 | ** | - | ||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||
| 29 | ** | - | ||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||
| 31 | ** | - | ||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||
| 33 | - | |||||||||||||
| 34 | /*! | - | ||||||||||||
| 35 | \class QParallelAnimationGroup | - | ||||||||||||
| 36 | \inmodule QtCore | - | ||||||||||||
| 37 | \brief The QParallelAnimationGroup class provides a parallel group of animations. | - | ||||||||||||
| 38 | \since 4.6 | - | ||||||||||||
| 39 | \ingroup animation | - | ||||||||||||
| 40 | - | |||||||||||||
| 41 | QParallelAnimationGroup--a \l{QAnimationGroup}{container for | - | ||||||||||||
| 42 | animations}--starts all its animations when it is | - | ||||||||||||
| 43 | \l{QAbstractAnimation::start()}{started} itself, i.e., runs all | - | ||||||||||||
| 44 | animations in parallel. The animation group finishes when the | - | ||||||||||||
| 45 | longest lasting animation has finished. | - | ||||||||||||
| 46 | - | |||||||||||||
| 47 | You can treat QParallelAnimationGroup as any other QAbstractAnimation, | - | ||||||||||||
| 48 | e.g., pause, resume, or add it to other animation groups. | - | ||||||||||||
| 49 | - | |||||||||||||
| 50 | \code | - | ||||||||||||
| 51 | QParallelAnimationGroup *group = new QParallelAnimationGroup; | - | ||||||||||||
| 52 | group->addAnimation(anim1); | - | ||||||||||||
| 53 | group->addAnimation(anim2); | - | ||||||||||||
| 54 | - | |||||||||||||
| 55 | group->start(); | - | ||||||||||||
| 56 | \endcode | - | ||||||||||||
| 57 | - | |||||||||||||
| 58 | In this example, \c anim1 and \c anim2 are two | - | ||||||||||||
| 59 | \l{QPropertyAnimation}s that have already been set up. | - | ||||||||||||
| 60 | - | |||||||||||||
| 61 | \sa QAnimationGroup, QPropertyAnimation, {The Animation Framework} | - | ||||||||||||
| 62 | */ | - | ||||||||||||
| 63 | - | |||||||||||||
| 64 | - | |||||||||||||
| 65 | #include "qparallelanimationgroup.h" | - | ||||||||||||
| 66 | #include "qparallelanimationgroup_p.h" | - | ||||||||||||
| 67 | //#define QANIMATION_DEBUG | - | ||||||||||||
| 68 | - | |||||||||||||
| 69 | #ifndef QT_NO_ANIMATION | - | ||||||||||||
| 70 | - | |||||||||||||
| 71 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 72 | - | |||||||||||||
| 73 | typedef QList<QAbstractAnimation *>::ConstIterator AnimationListConstIt; | - | ||||||||||||
| 74 | typedef QHash<QAbstractAnimation*, int>::Iterator AnimationTimeHashIt; | - | ||||||||||||
| 75 | typedef QHash<QAbstractAnimation*, int>::ConstIterator AnimationTimeHashConstIt; | - | ||||||||||||
| 76 | - | |||||||||||||
| 77 | /*! | - | ||||||||||||
| 78 | Constructs a QParallelAnimationGroup. | - | ||||||||||||
| 79 | \a parent is passed to QObject's constructor. | - | ||||||||||||
| 80 | */ | - | ||||||||||||
| 81 | QParallelAnimationGroup::QParallelAnimationGroup(QObject *parent) | - | ||||||||||||
| 82 | : QAnimationGroup(*new QParallelAnimationGroupPrivate, parent) | - | ||||||||||||
| 83 | { | - | ||||||||||||
| 84 | } executed 81 times by 5 tests: end of blockExecuted by:
| 81 | ||||||||||||
| 85 | - | |||||||||||||
| 86 | /*! | - | ||||||||||||
| 87 | \internal | - | ||||||||||||
| 88 | */ | - | ||||||||||||
| 89 | QParallelAnimationGroup::QParallelAnimationGroup(QParallelAnimationGroupPrivate &dd, | - | ||||||||||||
| 90 | QObject *parent) | - | ||||||||||||
| 91 | : QAnimationGroup(dd, parent) | - | ||||||||||||
| 92 | { | - | ||||||||||||
| 93 | } never executed: end of block | 0 | ||||||||||||
| 94 | - | |||||||||||||
| 95 | /*! | - | ||||||||||||
| 96 | Destroys the animation group. It will also destroy all its animations. | - | ||||||||||||
| 97 | */ | - | ||||||||||||
| 98 | QParallelAnimationGroup::~QParallelAnimationGroup() | - | ||||||||||||
| 99 | { | - | ||||||||||||
| 100 | } | - | ||||||||||||
| 101 | - | |||||||||||||
| 102 | /*! | - | ||||||||||||
| 103 | \reimp | - | ||||||||||||
| 104 | */ | - | ||||||||||||
| 105 | int QParallelAnimationGroup::duration() const | - | ||||||||||||
| 106 | { | - | ||||||||||||
| 107 | Q_D(const QParallelAnimationGroup); | - | ||||||||||||
| 108 | int ret = 0; | - | ||||||||||||
| 109 | - | |||||||||||||
| 110 | for (AnimationListConstIt it = d->animations.constBegin(), cend = d->animations.constEnd(); it != cend; ++it) {
| 505-1359 | ||||||||||||
| 111 | const int currentDuration = (*it)->totalDuration(); | - | ||||||||||||
| 112 | if (currentDuration == -1)
| 9-1350 | ||||||||||||
| 113 | return -1; // Undetermined length executed 9 times by 2 tests: return -1;Executed by:
| 9 | ||||||||||||
| 114 | - | |||||||||||||
| 115 | ret = qMax(ret, currentDuration); | - | ||||||||||||
| 116 | } executed 1350 times by 5 tests: end of blockExecuted by:
| 1350 | ||||||||||||
| 117 | - | |||||||||||||
| 118 | return ret; executed 505 times by 5 tests: return ret;Executed by:
| 505 | ||||||||||||
| 119 | } | - | ||||||||||||
| 120 | - | |||||||||||||
| 121 | /*! | - | ||||||||||||
| 122 | \reimp | - | ||||||||||||
| 123 | */ | - | ||||||||||||
| 124 | void QParallelAnimationGroup::updateCurrentTime(int currentTime) | - | ||||||||||||
| 125 | { | - | ||||||||||||
| 126 | Q_D(QParallelAnimationGroup); | - | ||||||||||||
| 127 | if (d->animations.isEmpty())
| 0-325 | ||||||||||||
| 128 | return; never executed: return; | 0 | ||||||||||||
| 129 | - | |||||||||||||
| 130 | if (d->currentLoop > d->lastLoop) {
| 45-280 | ||||||||||||
| 131 | // simulate completion of the loop | - | ||||||||||||
| 132 | int dura = duration(); | - | ||||||||||||
| 133 | if (dura > 0) {
| 0-45 | ||||||||||||
| 134 | for (AnimationListConstIt it = d->animations.constBegin(), cend = d->animations.constEnd(); it != cend; ++it) {
| 45-136 | ||||||||||||
| 135 | QAbstractAnimation *animation = (*it); | - | ||||||||||||
| 136 | if (animation->state() != QAbstractAnimation::Stopped)
| 52-84 | ||||||||||||
| 137 | animation->setCurrentTime(dura); // will stop executed 52 times by 2 tests: animation->setCurrentTime(dura);Executed by:
| 52 | ||||||||||||
| 138 | } executed 136 times by 2 tests: end of blockExecuted by:
| 136 | ||||||||||||
| 139 | } executed 45 times by 2 tests: end of blockExecuted by:
| 45 | ||||||||||||
| 140 | } else if (d->currentLoop < d->lastLoop) { executed 45 times by 2 tests: end of blockExecuted by:
| 28-252 | ||||||||||||
| 141 | // simulate completion of the loop seeking backwards | - | ||||||||||||
| 142 | for (AnimationListConstIt it = d->animations.constBegin(), cend = d->animations.constEnd(); it != cend; ++it) {
| 28-84 | ||||||||||||
| 143 | QAbstractAnimation *animation = *it; | - | ||||||||||||
| 144 | //we need to make sure the animation is in the right state | - | ||||||||||||
| 145 | //and then rewind it | - | ||||||||||||
| 146 | d->applyGroupState(animation); | - | ||||||||||||
| 147 | animation->setCurrentTime(0); | - | ||||||||||||
| 148 | animation->stop(); | - | ||||||||||||
| 149 | } executed 84 times by 1 test: end of blockExecuted by:
| 84 | ||||||||||||
| 150 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||
| 151 | - | |||||||||||||
| 152 | #ifdef QANIMATION_DEBUG | - | ||||||||||||
| 153 | qDebug("QParallellAnimationGroup %5d: setCurrentTime(%d), loop:%d, last:%d, timeFwd:%d, lastcurrent:%d, %d", | - | ||||||||||||
| 154 | __LINE__, d->currentTime, d->currentLoop, d->lastLoop, timeFwd, d->lastCurrentTime, state()); | - | ||||||||||||
| 155 | #endif | - | ||||||||||||
| 156 | // finally move into the actual time of the current loop | - | ||||||||||||
| 157 | for (AnimationListConstIt it = d->animations.constBegin(), cend = d->animations.constEnd(); it != cend; ++it) {
| 325-947 | ||||||||||||
| 158 | QAbstractAnimation *animation = *it; | - | ||||||||||||
| 159 | const int dura = animation->totalDuration(); | - | ||||||||||||
| 160 | //if the loopcount is bigger we should always start all animations | - | ||||||||||||
| 161 | if (d->currentLoop > d->lastLoop
| 136-811 | ||||||||||||
| 162 | //if we're at the end of the animation, we need to start it if it wasn't already started in this loop | - | ||||||||||||
| 163 | //this happens in Backward direction where not all animations are started at the same time | - | ||||||||||||
| 164 | || d->shouldAnimationStart(animation, d->lastCurrentTime > dura /*startIfAtEnd*/)) {
| 260-551 | ||||||||||||
| 165 | d->applyGroupState(animation); | - | ||||||||||||
| 166 | } executed 687 times by 5 tests: end of blockExecuted by:
| 687 | ||||||||||||
| 167 | - | |||||||||||||
| 168 | if (animation->state() == state()) {
| 180-767 | ||||||||||||
| 169 | animation->setCurrentTime(currentTime); | - | ||||||||||||
| 170 | if (dura > 0 && currentTime > dura)
| 33-655 | ||||||||||||
| 171 | animation->stop(); executed 33 times by 3 tests: animation->stop();Executed by:
| 33 | ||||||||||||
| 172 | } executed 767 times by 5 tests: end of blockExecuted by:
| 767 | ||||||||||||
| 173 | } executed 947 times by 5 tests: end of blockExecuted by:
| 947 | ||||||||||||
| 174 | d->lastLoop = d->currentLoop; | - | ||||||||||||
| 175 | d->lastCurrentTime = currentTime; | - | ||||||||||||
| 176 | } executed 325 times by 5 tests: end of blockExecuted by:
| 325 | ||||||||||||
| 177 | - | |||||||||||||
| 178 | /*! | - | ||||||||||||
| 179 | \reimp | - | ||||||||||||
| 180 | */ | - | ||||||||||||
| 181 | void QParallelAnimationGroup::updateState(QAbstractAnimation::State newState, | - | ||||||||||||
| 182 | QAbstractAnimation::State oldState) | - | ||||||||||||
| 183 | { | - | ||||||||||||
| 184 | Q_D(QParallelAnimationGroup); | - | ||||||||||||
| 185 | QAnimationGroup::updateState(newState, oldState); | - | ||||||||||||
| 186 | - | |||||||||||||
| 187 | switch (newState) { | - | ||||||||||||
| 188 | case Stopped: executed 57 times by 3 tests: case Stopped:Executed by:
| 57 | ||||||||||||
| 189 | for (AnimationListConstIt it = d->animations.constBegin(), cend = d->animations.constEnd(); it != cend; ++it)
| 41-57 | ||||||||||||
| 190 | (*it)->stop(); executed 41 times by 3 tests: (*it)->stop();Executed by:
| 41 | ||||||||||||
| 191 | d->disconnectUncontrolledAnimations(); | - | ||||||||||||
| 192 | break; executed 57 times by 3 tests: break;Executed by:
| 57 | ||||||||||||
| 193 | case Paused: executed 4 times by 2 tests: case Paused:Executed by:
| 4 | ||||||||||||
| 194 | for (AnimationListConstIt it = d->animations.constBegin(), cend = d->animations.constEnd(); it != cend; ++it) {
| 4-6 | ||||||||||||
| 195 | if ((*it)->state() == Running)
| 1-5 | ||||||||||||
| 196 | (*it)->pause(); executed 5 times by 2 tests: (*it)->pause();Executed by:
| 5 | ||||||||||||
| 197 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 198 | break; executed 4 times by 2 tests: break;Executed by:
| 4 | ||||||||||||
| 199 | case Running: executed 62 times by 4 tests: case Running:Executed by:
| 62 | ||||||||||||
| 200 | d->connectUncontrolledAnimations(); | - | ||||||||||||
| 201 | for (AnimationListConstIt it = d->animations.constBegin(), cend = d->animations.constEnd(); it != cend; ++it) {
| 62-168 | ||||||||||||
| 202 | QAbstractAnimation *animation = *it; | - | ||||||||||||
| 203 | if (oldState == Stopped)
| 4-164 | ||||||||||||
| 204 | animation->stop(); executed 164 times by 4 tests: animation->stop();Executed by:
| 164 | ||||||||||||
| 205 | animation->setDirection(d->direction); | - | ||||||||||||
| 206 | if (d->shouldAnimationStart(animation, oldState == Stopped))
| 54-114 | ||||||||||||
| 207 | animation->start(); executed 114 times by 4 tests: animation->start();Executed by:
| 114 | ||||||||||||
| 208 | } executed 168 times by 4 tests: end of blockExecuted by:
| 168 | ||||||||||||
| 209 | break; executed 62 times by 4 tests: break;Executed by:
| 62 | ||||||||||||
| 210 | } | - | ||||||||||||
| 211 | } executed 123 times by 4 tests: end of blockExecuted by:
| 123 | ||||||||||||
| 212 | - | |||||||||||||
| 213 | void QParallelAnimationGroupPrivate::_q_uncontrolledAnimationFinished() | - | ||||||||||||
| 214 | { | - | ||||||||||||
| 215 | Q_Q(QParallelAnimationGroup); | - | ||||||||||||
| 216 | - | |||||||||||||
| 217 | QAbstractAnimation *animation = qobject_cast<QAbstractAnimation *>(q->sender()); | - | ||||||||||||
| 218 | Q_ASSERT(animation); | - | ||||||||||||
| 219 | - | |||||||||||||
| 220 | int uncontrolledRunningCount = 0; | - | ||||||||||||
| 221 | if (animation->duration() == -1 || animation->loopCount() < 0) {
| 0-1 | ||||||||||||
| 222 | for (AnimationTimeHashIt it = uncontrolledFinishTime.begin(), cend = uncontrolledFinishTime.end(); it != cend; ++it) {
| 2-4 | ||||||||||||
| 223 | if (it.key() == animation) {
| 2 | ||||||||||||
| 224 | *it = animation->currentTime(); | - | ||||||||||||
| 225 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 226 | if (it.value() == -1)
| 1-3 | ||||||||||||
| 227 | ++uncontrolledRunningCount; executed 1 time by 1 test: ++uncontrolledRunningCount;Executed by:
| 1 | ||||||||||||
| 228 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 229 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 230 | - | |||||||||||||
| 231 | if (uncontrolledRunningCount > 0)
| 1 | ||||||||||||
| 232 | return; executed 1 time by 1 test: return;Executed by:
| 1 | ||||||||||||
| 233 | - | |||||||||||||
| 234 | int maxDuration = 0; | - | ||||||||||||
| 235 | for (AnimationListConstIt it = animations.constBegin(), cend = animations.constEnd(); it != cend; ++it)
| 1-3 | ||||||||||||
| 236 | maxDuration = qMax(maxDuration, (*it)->totalDuration()); executed 3 times by 1 test: maxDuration = qMax(maxDuration, (*it)->totalDuration());Executed by:
| 3 | ||||||||||||
| 237 | - | |||||||||||||
| 238 | if (currentTime >= maxDuration)
| 0-1 | ||||||||||||
| 239 | q->stop(); executed 1 time by 1 test: q->stop();Executed by:
| 1 | ||||||||||||
| 240 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 241 | - | |||||||||||||
| 242 | void QParallelAnimationGroupPrivate::disconnectUncontrolledAnimations() | - | ||||||||||||
| 243 | { | - | ||||||||||||
| 244 | for (AnimationTimeHashConstIt it = uncontrolledFinishTime.constBegin(), cend = uncontrolledFinishTime.constEnd(); it != cend; ++it)
| 3-57 | ||||||||||||
| 245 | disconnectUncontrolledAnimation(it.key()); executed 3 times by 1 test: disconnectUncontrolledAnimation(it.key());Executed by:
| 3 | ||||||||||||
| 246 | - | |||||||||||||
| 247 | uncontrolledFinishTime.clear(); | - | ||||||||||||
| 248 | } executed 57 times by 3 tests: end of blockExecuted by:
| 57 | ||||||||||||
| 249 | - | |||||||||||||
| 250 | void QParallelAnimationGroupPrivate::connectUncontrolledAnimations() | - | ||||||||||||
| 251 | { | - | ||||||||||||
| 252 | for (AnimationListConstIt it = animations.constBegin(), cend = animations.constEnd(); it != cend; ++it) {
| 62-168 | ||||||||||||
| 253 | QAbstractAnimation *animation = *it; | - | ||||||||||||
| 254 | if (animation->duration() == -1 || animation->loopCount() < 0) {
| 1-167 | ||||||||||||
| 255 | uncontrolledFinishTime[animation] = -1; | - | ||||||||||||
| 256 | connectUncontrolledAnimation(animation); | - | ||||||||||||
| 257 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||
| 258 | } executed 168 times by 4 tests: end of blockExecuted by:
| 168 | ||||||||||||
| 259 | } executed 62 times by 4 tests: end of blockExecuted by:
| 62 | ||||||||||||
| 260 | - | |||||||||||||
| 261 | bool QParallelAnimationGroupPrivate::shouldAnimationStart(QAbstractAnimation *animation, bool startIfAtEnd) const | - | ||||||||||||
| 262 | { | - | ||||||||||||
| 263 | const int dura = animation->totalDuration(); | - | ||||||||||||
| 264 | if (dura == -1)
| 20-959 | ||||||||||||
| 265 | return !isUncontrolledAnimationFinished(animation); executed 20 times by 2 tests: return !isUncontrolledAnimationFinished(animation);Executed by:
| 20 | ||||||||||||
| 266 | if (startIfAtEnd)
| 331-628 | ||||||||||||
| 267 | return currentTime <= dura; executed 331 times by 4 tests: return currentTime <= dura;Executed by:
| 331 | ||||||||||||
| 268 | if (direction == QAbstractAnimation::Forward)
| 63-565 | ||||||||||||
| 269 | return currentTime < dura; executed 565 times by 5 tests: return currentTime < dura;Executed by:
| 565 | ||||||||||||
| 270 | else //direction == QAbstractAnimation::Backward | - | ||||||||||||
| 271 | return currentTime && currentTime <= dura; executed 63 times by 1 test: return currentTime && currentTime <= dura;Executed by:
| 2-63 | ||||||||||||
| 272 | } | - | ||||||||||||
| 273 | - | |||||||||||||
| 274 | void QParallelAnimationGroupPrivate::applyGroupState(QAbstractAnimation *animation) | - | ||||||||||||
| 275 | { | - | ||||||||||||
| 276 | switch (state) | - | ||||||||||||
| 277 | { | - | ||||||||||||
| 278 | case QAbstractAnimation::Running: executed 634 times by 4 tests: case QAbstractAnimation::Running:Executed by:
| 634 | ||||||||||||
| 279 | animation->start(); | - | ||||||||||||
| 280 | break; executed 634 times by 4 tests: break;Executed by:
| 634 | ||||||||||||
| 281 | case QAbstractAnimation::Paused: never executed: case QAbstractAnimation::Paused: | 0 | ||||||||||||
| 282 | animation->pause(); | - | ||||||||||||
| 283 | break; never executed: break; | 0 | ||||||||||||
| 284 | case QAbstractAnimation::Stopped: executed 137 times by 2 tests: case QAbstractAnimation::Stopped:Executed by:
| 137 | ||||||||||||
| 285 | default: never executed: default: | 0 | ||||||||||||
| 286 | break; executed 137 times by 2 tests: break;Executed by:
| 137 | ||||||||||||
| 287 | } | - | ||||||||||||
| 288 | } | - | ||||||||||||
| 289 | - | |||||||||||||
| 290 | - | |||||||||||||
| 291 | bool QParallelAnimationGroupPrivate::isUncontrolledAnimationFinished(QAbstractAnimation *anim) const | - | ||||||||||||
| 292 | { | - | ||||||||||||
| 293 | return uncontrolledFinishTime.value(anim, -1) >= 0; executed 20 times by 2 tests: return uncontrolledFinishTime.value(anim, -1) >= 0;Executed by:
| 20 | ||||||||||||
| 294 | } | - | ||||||||||||
| 295 | - | |||||||||||||
| 296 | void QParallelAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *anim) | - | ||||||||||||
| 297 | { | - | ||||||||||||
| 298 | QAnimationGroupPrivate::animationRemoved(index, anim); | - | ||||||||||||
| 299 | disconnectUncontrolledAnimation(anim); | - | ||||||||||||
| 300 | uncontrolledFinishTime.remove(anim); | - | ||||||||||||
| 301 | } executed 164 times by 2 tests: end of blockExecuted by:
| 164 | ||||||||||||
| 302 | - | |||||||||||||
| 303 | /*! | - | ||||||||||||
| 304 | \reimp | - | ||||||||||||
| 305 | */ | - | ||||||||||||
| 306 | void QParallelAnimationGroup::updateDirection(QAbstractAnimation::Direction direction) | - | ||||||||||||
| 307 | { | - | ||||||||||||
| 308 | Q_D(QParallelAnimationGroup); | - | ||||||||||||
| 309 | //we need to update the direction of the current animation | - | ||||||||||||
| 310 | if (state() != Stopped) {
| 0-19 | ||||||||||||
| 311 | for (AnimationListConstIt it = d->animations.constBegin(), cend = d->animations.constEnd(); it != cend; ++it)
| 0 | ||||||||||||
| 312 | (*it)->setDirection(direction); never executed: (*it)->setDirection(direction); | 0 | ||||||||||||
| 313 | } else { never executed: end of block | 0 | ||||||||||||
| 314 | if (direction == Forward) {
| 0-19 | ||||||||||||
| 315 | d->lastLoop = 0; | - | ||||||||||||
| 316 | d->lastCurrentTime = 0; | - | ||||||||||||
| 317 | } else { never executed: end of block | 0 | ||||||||||||
| 318 | // Looping backwards with loopCount == -1 does not really work well... | - | ||||||||||||
| 319 | d->lastLoop = (d->loopCount == -1 ? 0 : d->loopCount - 1);
| 3-16 | ||||||||||||
| 320 | d->lastCurrentTime = duration(); | - | ||||||||||||
| 321 | } executed 19 times by 1 test: end of blockExecuted by:
| 19 | ||||||||||||
| 322 | } | - | ||||||||||||
| 323 | } | - | ||||||||||||
| 324 | - | |||||||||||||
| 325 | /*! | - | ||||||||||||
| 326 | \reimp | - | ||||||||||||
| 327 | */ | - | ||||||||||||
| 328 | bool QParallelAnimationGroup::event(QEvent *event) | - | ||||||||||||
| 329 | { | - | ||||||||||||
| 330 | return QAnimationGroup::event(event); executed 520 times by 5 tests: return QAnimationGroup::event(event);Executed by:
| 520 | ||||||||||||
| 331 | } | - | ||||||||||||
| 332 | - | |||||||||||||
| 333 | QT_END_NAMESPACE | - | ||||||||||||
| 334 | - | |||||||||||||
| 335 | #include "moc_qparallelanimationgroup.cpp" | - | ||||||||||||
| 336 | - | |||||||||||||
| 337 | #endif //QT_NO_ANIMATION | - | ||||||||||||
| Source code | Switch to Preprocessed file |