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 if (startOffset > 0)
43 return false;
44
45 for (const auto& frame : frames) {
46 if (frame != frames.first())
47 return false;
48 }
49 return true;
50 }
51 };
52
53 QQuickAnimatedProperty(const QVariant &defaultValue)
54 : m_defaultValue(defaultValue)
55 {
56 }
57
58 bool isAnimated() const
59 {
60 return !m_animations.isEmpty();
61 }
62
63 QVariant defaultValue() const
64 {
65 return m_defaultValue;
66 }
67
68 void setDefaultValue(const QVariant &value)
69 {
70 m_defaultValue = value;
71 }
72
73 qsizetype animationCount() const
74 {
75 return m_animations.size();
76 }
77
78 const PropertyAnimation &animation(int index) const
79 {
80 return m_animations.at(index);
81 }
82
83 void addAnimation(const PropertyAnimation &animation)
84 {
85 if (m_animationGroups.isEmpty())
86 beginAnimationGroup();
87
88 m_animations.append(animation);
89 }
90
91 qsizetype animationGroupCount() const
92 {
93 return m_animationGroups.size();
94 }
95
96 int animationGroup(int index) const
97 {
98 return m_animationGroups.at(index);
99 }
100
101 void beginAnimationGroup()
102 {
103 m_animationGroups.append(m_animations.size());
104 }
105
106private:
107 QVariant m_defaultValue;
108 QList<PropertyAnimation> m_animations;
109 QList<int> m_animationGroups;
110};
111
112QT_END_NAMESPACE
113
114#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
bool visitSymbolNodeStart(const QSvgSymbol *node) override
void visitImageNode(const QSvgImage *node) override
void visitTextNode(const QSvgText *node) override
void visitSwitchNodeEnd(const QSvgSwitch *node) override
void visitSymbolNodeEnd(const QSvgSymbol *node) override
bool visitStructureNodeStart(const QSvgStructureNode *node) override
Combined button and popup list for selecting options.
QT_BEGIN_NAMESPACE QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY(lcAotCompiler, Q_QMLCOMPILER_EXPORT)