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