Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickanimationrootitem.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 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
5
7
8QQuickAnimationRootItem::QQuickAnimationRootItem(QQuickItem *parent) : QQuickItem(parent) { }
9
10bool QQuickAnimationRootItem::paused() const
11{
12 return m_paused;
13}
14
15void QQuickAnimationRootItem::setPaused(bool paused)
16{
17 if (m_paused == paused)
18 return;
19 m_paused = paused;
20 for (const QPointer<QQuickAbstractAnimation> &anim : std::as_const(m_masterAnimations)) {
21 if (anim && anim->isRunning())
22 anim->setPaused(paused);
23 }
24 emit pausedChanged();
25}
26
27int QQuickAnimationRootItem::loops() const
28{
29 return m_loops;
30}
31
32void QQuickAnimationRootItem::setLoops(int loops)
33{
34 if (m_loops == loops)
35 return;
36 m_loops = loops;
37 for (const QPointer<QQuickAbstractAnimation> &anim : std::as_const(m_masterAnimations)) {
38 if (!anim)
39 continue;
40 anim->setLoops(loops);
41 if (anim->isRunning())
42 anim->restart();
43 }
44 emit loopsChanged();
45}
46
47QVariantMap QQuickAnimationRootItem::markers() const
48{
49 return m_markers;
50}
51
52void QQuickAnimationRootItem::setMarkersData(const QVariantMap &markers)
53{
54 if (m_markers == markers)
55 return;
56 m_markers = markers;
57 emit markersChanged();
58}
59
60qreal QQuickAnimationRootItem::startFrame() const
61{
62 return m_startFrame;
63}
64
65void QQuickAnimationRootItem::setStartFrame(qreal startFrame)
66{
67 if (m_startFrame == startFrame)
68 return;
69 m_startFrame = startFrame;
70 emit startFrameChanged();
71}
72
73qreal QQuickAnimationRootItem::endFrame() const
74{
75 return m_endFrame;
76}
77
78void QQuickAnimationRootItem::setEndFrame(qreal endFrame)
79{
80 if (m_endFrame == endFrame)
81 return;
82 m_endFrame = endFrame;
83 emit endFrameChanged();
84}
85
86qreal QQuickAnimationRootItem::frameRate() const
87{
88 return m_frameRate;
89}
90
91void QQuickAnimationRootItem::setFrameRate(qreal frameRate)
92{
93 if (m_frameRate == frameRate)
94 return;
95 m_frameRate = frameRate;
96 emit frameRateChanged();
97}
98
99qreal QQuickAnimationRootItem::frameCounter() const
100{
101 return m_frameCounter;
102}
103
104void QQuickAnimationRootItem::setFrameCounter(qreal frameCounter)
105{
106 if (m_frameCounter == frameCounter)
107 return;
108 m_frameCounter = frameCounter;
109 emit frameCounterChanged();
110}
111
112void QQuickAnimationRootItem::restart()
113{
114 for (const QPointer<QQuickAbstractAnimation> &anim : std::as_const(m_masterAnimations)) {
115 if (anim)
116 anim->restart();
117 }
118}
119
120void QQuickAnimationRootItem::addMasterAnimation(QQuickAbstractAnimation *anim)
121{
122 if (!anim)
123 return;
124 m_masterAnimations.append(anim);
125 anim->setLoops(m_loops);
126 if (m_paused && anim->isRunning())
127 anim->setPaused(true);
128}
129
130QT_END_NAMESPACE
Combined button and popup list for selecting options.