78 #ifndef QT_NO_ANIMATION 115 for (
int i = 0; i <
d->animations.size(); ++i) {
118 if (currentDuration == -1)
121 ret =
qMax(ret, currentDuration);
133 if (
d->animations.isEmpty())
136 if (
d->currentLoop >
d->lastLoop) {
140 for (
int i = 0; i <
d->animations.size(); ++i) {
143 d->animations.at(i)->setCurrentTime(dura);
146 }
else if (
d->currentLoop <
d->lastLoop) {
148 for (
int i = 0; i <
d->animations.size(); ++i) {
152 d->applyGroupState(animation);
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());
163 for (
int i = 0; i <
d->animations.size(); ++i) {
167 if (
d->currentLoop >
d->lastLoop
170 ||
d->shouldAnimationStart(animation,
d->lastCurrentTime > dura )) {
171 d->applyGroupState(animation);
176 if (dura > 0 && currentTime > dura)
180 d->lastLoop =
d->currentLoop;
195 for (
int i = 0; i <
d->animations.size(); ++i)
196 d->animations.at(i)->stop();
197 d->disconnectUncontrolledAnimations();
200 for (
int i = 0; i <
d->animations.size(); ++i)
201 if (
d->animations.at(i)->state() ==
Running)
202 d->animations.at(i)->pause();
205 d->connectUncontrolledAnimations();
206 for (
int i = 0; i <
d->animations.size(); ++i) {
211 if (
d->shouldAnimationStart(animation, oldState ==
Stopped))
225 int uncontrolledRunningCount = 0;
228 while (it != uncontrolledFinishTime.
end()) {
229 if (it.
key() == animation) {
232 if (it.
value() == -1)
233 ++uncontrolledRunningCount;
238 if (uncontrolledRunningCount > 0)
242 for (
int i = 0; i < animations.size(); ++i)
243 maxDuration =
qMax(maxDuration, animations.at(i)->totalDuration());
252 while (it != uncontrolledFinishTime.
end()) {
253 disconnectUncontrolledAnimation(it.
key());
257 uncontrolledFinishTime.clear();
262 for (
int i = 0; i < animations.size(); ++i) {
265 uncontrolledFinishTime[animation] = -1;
266 connectUncontrolledAnimation(animation);
275 return !isUncontrolledAnimationFinished(animation);
303 return uncontrolledFinishTime.value(anim, -1) >= 0;
309 disconnectUncontrolledAnimation(anim);
310 uncontrolledFinishTime.remove(anim);
321 for (
int i = 0; i <
d->animations.size(); ++i) {
328 d->lastCurrentTime = 0;
331 d->lastLoop = (
d->loopCount == -1 ? 0 :
d->loopCount - 1);
347 #include "moc_qparallelanimationgroup.cpp" 349 #endif //QT_NO_ANIMATION
#define QT_END_NAMESPACE
This macro expands to.
int totalDuration() const
Returns the total and effective duration of the animation, including the loop count.
State
This enum describes the state of the animation.
void animationRemoved(int index, QAbstractAnimation *)
#define it(className, varName)
void start(QAbstractAnimation::DeletionPolicy policy=KeepWhenStopped)
Starts the animation.
bool event(QEvent *event)
Reimplemented Function
T * qobject_cast(QObject *object)
void _q_uncontrolledAnimationFinished()
The QHash class is a template class that provides a hash-table-based dictionary.
The QObject class is the base class of all Qt objects.
State state
state of the animation.
const T value(const Key &key) const
Returns the value associated with the key.
void updateDirection(QAbstractAnimation::Direction direction)
Reimplemented Function
void stop()
Stops the animation.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
Reimplemented Function
Q_CORE_EXPORT void qDebug(const char *,...)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Direction
This enum describes the direction of the animation when in Running state.
void setDirection(Direction direction)
bool shouldAnimationStart(QAbstractAnimation *animation, bool startIfAtEnd) const
void connectUncontrolledAnimations()
The QAbstractAnimation class is the base of all animations.
void updateCurrentTime(int currentTime)
Reimplemented Function
int loopCount
the loop count of the animation
void applyGroupState(QAbstractAnimation *animation)
bool event(QEvent *event)
Reimplemented Function
The QParallelAnimationGroup class provides a parallel group of animations.
virtual void animationRemoved(int, QAbstractAnimation *)
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
const Key key(const T &value) const
Returns the first key mapped to value.
QObject * parent() const
Returns a pointer to the parent object.
int currentTime
the current time and progress of the animation
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
This virtual function is called by QAbstractAnimation when the state of the animation is changed from...
void pause()
Pauses the animation.
bool isUncontrolledAnimationFinished(QAbstractAnimation *anim) const
void disconnectUncontrolledAnimations()
Direction direction() const
The QAnimationGroup class is an abstract base class for groups of animations.
The QEvent class is the base class of all event classes.
void setCurrentTime(int msecs)
int duration() const
Reimplemented Function
QParallelAnimationGroup(QObject *parent=0)
Constructs a QParallelAnimationGroup.
int duration
the duration of the animation.
~QParallelAnimationGroup()
Destroys the animation group.