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
qquickanimatedproperty_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 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
4#ifndef QQUICKANIMATEDPROPERTY_P_H
5#define QQUICKANIMATEDPROPERTY_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QMap>
19#include <QVariant>
20#include <QtGui/private/qbezier_p.h>
21
23
24class QQuickAnimatedProperty
25{
26public:
27 struct PropertyAnimation {
28 enum Flag {
29 NoFlags = 0,
30 FreezeAtEnd = 1,
31 ReplacePreviousAnimations = 2,
32 };
33
34 QMap<int, QVariant> frames;
35 QMap<int, QBezier> easingPerFrame;
36 int subtype = 0;
37 int repeatCount = 1;
38 int startOffset = 0;
39 quint8 flags = NoFlags;
40
41 bool isConstant() const {
42 for (const auto& frame : frames) {
43 if (frame != frames.first())
44 return false;
45 }
46 return true;
47 }
48 };
49
50 QQuickAnimatedProperty(const QVariant &defaultValue)
51 : m_defaultValue(defaultValue)
52 {
53 }
54
55 bool isAnimated() const
56 {
57 return !m_animations.isEmpty();
58 }
59
60 QVariant defaultValue() const
61 {
62 return m_defaultValue;
63 }
64
65 void setDefaultValue(const QVariant &value)
66 {
67 m_defaultValue = value;
68 }
69
70 qsizetype animationCount() const
71 {
72 return m_animations.size();
73 }
74
75 const PropertyAnimation &animation(int index) const
76 {
77 return m_animations.at(index);
78 }
79
80 void addAnimation(const PropertyAnimation &animation)
81 {
82 if (m_animationGroups.isEmpty())
83 beginAnimationGroup();
84
85 m_animations.append(animation);
86 }
87
88 qsizetype animationGroupCount() const
89 {
90 return m_animationGroups.size();
91 }
92
93 int animationGroup(int index) const
94 {
95 return m_animationGroups.at(index);
96 }
97
98 void beginAnimationGroup()
99 {
100 m_animationGroups.append(m_animations.size());
101 }
102
103private:
104 QVariant m_defaultValue;
105 QList<PropertyAnimation> m_animations;
106 QList<int> m_animationGroups;
107};
108
109QT_END_NAMESPACE
110
111#endif // QQUICKANIMATEDPROPERTY_P_H
void visitPolygonNode(const QSvgPolygon *node) override
bool visitSwitchNodeStart(const QSvgSwitch *node) override
void visitMaskNodeEnd(const QSvgMask *node) override
void visitEllipseNode(const QSvgEllipse *node) override
void visitPathNode(const QSvgPath *node) override
bool visitDefsNodeStart(const QSvgDefs *node) override
bool visitMaskNodeStart(const QSvgMask *node) override
void visitDocumentNodeEnd(const QSvgTinyDocument *node) override
void visitStructureNodeEnd(const QSvgStructureNode *node) override
void visitRectNode(const QSvgRect *node) override
void visitLineNode(const QSvgLine *node) override
void visitNode(const QSvgNode *node) override
void visitPolylineNode(const QSvgPolyline *node) override
QSvgVisitorImpl(const QString svgFileName, QQuickGenerator *generator, bool assumeTrustedSource)
void visitUseNode(const QSvgUse *node) override
bool visitDocumentNodeStart(const QSvgTinyDocument *node) override
void visitImageNode(const QSvgImage *node) override
void visitTextNode(const QSvgText *node) override
void visitSwitchNodeEnd(const QSvgSwitch *node) override
bool visitStructureNodeStart(const QSvgStructureNode *node) override
QT_BEGIN_NAMESPACE QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY(lcAotCompiler, Q_QMLCOMPILER_EXPORT)