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
qsvganimator.cpp
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company 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 reason:default
4
5
6
#
include
"qsvganimator_p.h"
7
#
include
<
QtCore
/
qdatetime
.
h
>
8
#
include
<
QtSvg
/
private
/
qsvganimate_p
.
h
>
9
10
QT_BEGIN_NAMESPACE
11
12
QSvgAbstractAnimator::~QSvgAbstractAnimator()
13
{
14
for
(
auto
animationHash : {&m_animationsCSS, &m_animationsSMIL}) {
15
for
(
const
auto
&nodeAnimations : std::as_const(*animationHash)) {
16
for
(QSvgAbstractAnimation *anim : nodeAnimations)
17
delete
anim;
18
}
19
}
20
}
21
22
23
void
QSvgAbstractAnimator::appendAnimation(
const
QSvgNode *node, QSvgAbstractAnimation *anim)
24
{
25
if
(!node)
26
return
;
27
28
if
(anim->animationType() == QSvgAbstractAnimation::SMIL)
29
m_animationsSMIL[node].append(anim);
30
else
31
m_animationsCSS[node].append(anim);
32
}
33
34
QList<QSvgAbstractAnimation *> QSvgAbstractAnimator::animationsForNode(
const
QSvgNode *node)
const
35
{
36
return
combinedAnimationsForNode(node);
37
}
38
39
void
QSvgAbstractAnimator::advanceAnimations()
40
{
41
qreal elapsedTime = currentElapsed();
42
for
(
auto
animationHash : {&m_animationsCSS, &m_animationsSMIL}) {
43
for
(
const
auto
&nodeAnimations : std::as_const(*animationHash)) {
44
for
(QSvgAbstractAnimation *anim : nodeAnimations)
45
anim->evaluateAnimation(elapsedTime);
46
}
47
}
48
}
49
50
void
QSvgAbstractAnimator::setAnimationDuration(qint64 dur)
51
{
52
m_animationDuration = dur;
53
}
54
55
qint64 QSvgAbstractAnimator::animationDuration()
const
56
{
57
return
m_animationDuration;
58
}
59
60
QList<QSvgAbstractAnimation *> QSvgAbstractAnimator::combinedAnimationsForNode(
const
QSvgNode *node)
const
61
{
62
if
(!node)
63
return
QList<QSvgAbstractAnimation *>();
64
65
return
m_animationsSMIL.value(node) + m_animationsCSS.value(node);
66
}
67
68
QSvgAnimator::QSvgAnimator()
69
{
70
}
71
72
QSvgAnimator::~QSvgAnimator()
73
{
74
}
75
76
void
QSvgAnimator::restartAnimation()
77
{
78
m_time = QDateTime::currentMSecsSinceEpoch();
79
}
80
81
qint64 QSvgAnimator::currentElapsed()
82
{
83
return
QDateTime::currentMSecsSinceEpoch() - m_time;
84
}
85
86
void
QSvgAnimator::setAnimatorTime(qint64 time)
87
{
88
m_time -= time;
89
}
90
91
QSvgAnimationController::QSvgAnimationController()
92
{
93
}
94
95
QSvgAnimationController::~QSvgAnimationController()
96
{
97
}
98
99
void
QSvgAnimationController::restartAnimation()
100
{
101
m_time = 0;
102
}
103
104
qint64 QSvgAnimationController::currentElapsed()
105
{
106
return
m_time;
107
}
108
109
void
QSvgAnimationController::setAnimatorTime(qint64 time)
110
{
111
m_time = qMax(0, time);
112
}
113
114
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtsvg
src
svg
animation
qsvganimator.cpp
Generated on
for Qt by
1.18.0