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
qquickanimator_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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#ifndef QQUICKANIMATOR_P_H
6#define QQUICKANIMATOR_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
20
22
23class QQuickItem;
24
25class QQuickAnimatorJob;
27class Q_QUICK_EXPORT QQuickAnimator : public QQuickAbstractAnimation
28{
29 Q_OBJECT
30 Q_DECLARE_PRIVATE(QQuickAnimator)
31 Q_PROPERTY(QQuickItem *target READ targetItem WRITE setTargetItem NOTIFY targetItemChanged)
32 Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged)
33 Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
34 Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged)
35 Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged)
36
37 QML_NAMED_ELEMENT(Animator)
38 QML_ADDED_IN_VERSION(2, 2)
39 QML_UNCREATABLE("Animator is an abstract class")
40
41public:
42 QQuickItem *targetItem() const;
43 void setTargetItem(QQuickItem *target);
44
45 int duration() const;
46 void setDuration(int duration);
47
48 QEasingCurve easing() const;
49 void setEasing(const QEasingCurve & easing);
50
51 qreal to() const;
52 void setTo(qreal to);
53
54 qreal from() const;
55 void setFrom(qreal from);
56
57protected:
58 ThreadingModel threadingModel() const override { return RenderThread; }
59 virtual QQuickAnimatorJob *createJob() const = 0;
60 virtual QString propertyName() const = 0;
61 QAbstractAnimationJob *transition(QQuickStateActions &actions,
62 QQmlProperties &modified,
63 TransitionDirection,
64 QObject *) override;
65
66 QQuickAnimator(QQuickAnimatorPrivate &dd, QObject *parent = nullptr);
67 QQuickAnimator(QObject *parent = nullptr);
68
69Q_SIGNALS:
70 void targetItemChanged(QQuickItem *);
71 void durationChanged(int duration);
72 void easingChanged(const QEasingCurve &curve);
73 void toChanged(qreal to);
74 void fromChanged(qreal from);
75};
76
77class Q_QUICK_EXPORT QQuickScaleAnimator : public QQuickAnimator
78{
79 Q_OBJECT
80 QML_NAMED_ELEMENT(ScaleAnimator)
81 QML_ADDED_IN_VERSION(2, 2)
82public:
83 QQuickScaleAnimator(QObject *parent = nullptr);
84protected:
85 QQuickAnimatorJob *createJob() const override;
86 QString propertyName() const override { return QStringLiteral("scale"); }
87};
88
89class Q_QUICK_EXPORT QQuickXAnimator : public QQuickAnimator
90{
91 Q_OBJECT
92 QML_NAMED_ELEMENT(XAnimator)
93 QML_ADDED_IN_VERSION(2, 2)
94public:
95 QQuickXAnimator(QObject *parent = nullptr);
96protected:
97 QQuickAnimatorJob *createJob() const override;
98 QString propertyName() const override { return QStringLiteral("x"); }
99};
100
101class Q_QUICK_EXPORT QQuickYAnimator : public QQuickAnimator
102{
103 Q_OBJECT
104 QML_NAMED_ELEMENT(YAnimator)
105 QML_ADDED_IN_VERSION(2, 2)
106public:
107 QQuickYAnimator(QObject *parent = nullptr);
108protected:
109 QQuickAnimatorJob *createJob() const override;
110 QString propertyName() const override { return QStringLiteral("y"); }
111};
112
113class Q_QUICK_EXPORT QQuickOpacityAnimator : public QQuickAnimator
114{
115 Q_OBJECT
116 QML_NAMED_ELEMENT(OpacityAnimator)
117 QML_ADDED_IN_VERSION(2, 2)
118public:
119 QQuickOpacityAnimator(QObject *parent = nullptr);
120protected:
121 QQuickAnimatorJob *createJob() const override;
122 QString propertyName() const override { return QStringLiteral("opacity"); }
123};
124
126class Q_QUICK_EXPORT QQuickRotationAnimator : public QQuickAnimator
127{
128 Q_OBJECT
129 Q_DECLARE_PRIVATE(QQuickRotationAnimator)
130 Q_PROPERTY(RotationDirection direction READ direction WRITE setDirection NOTIFY directionChanged)
131 QML_NAMED_ELEMENT(RotationAnimator)
132 QML_ADDED_IN_VERSION(2, 2)
133
134public:
135 enum RotationDirection { Numerical, Shortest, Clockwise, Counterclockwise };
136 Q_ENUM(RotationDirection)
137
138 QQuickRotationAnimator(QObject *parent = nullptr);
139
140 void setDirection(RotationDirection dir);
141 RotationDirection direction() const;
142
143Q_SIGNALS:
144 void directionChanged(QQuickRotationAnimator::RotationDirection dir);
145
146protected:
147 QQuickAnimatorJob *createJob() const override;
148 QString propertyName() const override { return QStringLiteral("rotation"); }
149};
150
151#if QT_CONFIG(quick_shadereffect)
152class QQuickUniformAnimatorPrivate;
153class Q_QUICK_EXPORT QQuickUniformAnimator : public QQuickAnimator
154{
155 Q_OBJECT
156 Q_DECLARE_PRIVATE(QQuickUniformAnimator)
157 Q_PROPERTY(QString uniform READ uniform WRITE setUniform NOTIFY uniformChanged)
158 QML_NAMED_ELEMENT(UniformAnimator)
159 QML_ADDED_IN_VERSION(2, 2)
160
161public:
162 QQuickUniformAnimator(QObject *parent = nullptr);
163
164 QString uniform() const;
165 void setUniform(const QString &);
166
167Q_SIGNALS:
168 void uniformChanged(const QString &);
169
170protected:
171 QQuickAnimatorJob *createJob() const override;
172 QString propertyName() const override;
173};
174#endif
175
176QT_END_NAMESPACE
177
178#endif // QQUICKANIMATOR_P_H
void apply(QQuickAnimatorJob *job, const QString &propertyName, QQuickStateActions &actions, QQmlProperties &modified, QObject *defaultTarget)
QList< QQmlProperty > QQmlProperties
QQuickStateOperation::ActionList QQuickStateActions