Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qcontinuinganimationgroupjob.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 Jolla Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant
4
5
#
include
"private/qcontinuinganimationgroupjob_p.h"
6
#
include
"private/qanimationjobutil_p.h"
7
8
QT_BEGIN_NAMESPACE
9
10
QContinuingAnimationGroupJob::QContinuingAnimationGroupJob()
11
{
12
}
13
14
QContinuingAnimationGroupJob::~QContinuingAnimationGroupJob()
15
{
16
}
17
18
void
QContinuingAnimationGroupJob::updateCurrentTime(
int
/*currentTime*/
)
19
{
20
Q_ASSERT(!m_children.isEmpty());
21
for
(QAbstractAnimationJob *animation : m_children) {
22
if
(animation->state() == state()) {
23
RETURN_IF_DELETED(animation->setCurrentTime(m_currentTime));
24
}
25
}
26
}
27
28
void
QContinuingAnimationGroupJob::updateState(QAbstractAnimationJob::State newState,
29
QAbstractAnimationJob::State oldState)
30
{
31
QAnimationGroupJob::updateState(newState, oldState);
32
33
switch
(newState) {
34
case
Stopped:
35
for
(QAbstractAnimationJob *animation : m_children)
36
animation->stop();
37
break
;
38
case
Paused:
39
for
(QAbstractAnimationJob *animation : m_children)
40
if
(animation->isRunning())
41
animation->pause();
42
break
;
43
case
Running:
44
if
(m_children.isEmpty()) {
45
stop();
46
return
;
47
}
48
for
(QAbstractAnimationJob *animation : m_children) {
49
RETURN_IF_DELETED(resetUncontrolledAnimationFinishTime(animation));
50
animation->setDirection(m_direction);
51
RETURN_IF_DELETED(animation->start());
52
}
53
break
;
54
}
55
}
56
57
void
QContinuingAnimationGroupJob::updateDirection(QAbstractAnimationJob::Direction direction)
58
{
59
if
(!isStopped()) {
60
for
(QAbstractAnimationJob *animation : m_children)
61
animation->setDirection(direction);
62
}
63
}
64
65
void
QContinuingAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimationJob *animation)
66
{
67
Q_ASSERT(animation && (animation->duration() == -1));
68
int
uncontrolledRunningCount = 0;
69
70
for
(QAbstractAnimationJob *child : m_children) {
71
if
(child == animation)
72
setUncontrolledAnimationFinishTime(animation, animation->currentTime());
73
else
if
(uncontrolledAnimationFinishTime(child) == -1)
74
++uncontrolledRunningCount;
75
}
76
77
if
(uncontrolledRunningCount > 0)
78
return
;
79
80
setUncontrolledAnimationFinishTime(
this
, currentTime());
81
stop();
82
}
83
84
void
QContinuingAnimationGroupJob::debugAnimation(QDebug d)
const
85
{
86
d <<
"ContinuingAnimationGroupJob("
<< Qt::hex << (
const
void
*)
this
<< Qt::dec <<
")"
;
87
88
debugChildren(d);
89
}
90
91
QT_END_NAMESPACE
qtdeclarative
src
qml
animations
qcontinuinganimationgroupjob.cpp
Generated on
for Qt by
1.18.0