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 | |
4 | #ifndef QQUICKITEMANIMATION_H |
5 | #define QQUICKITEMANIMATION_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 "qquickitem.h" |
19 | |
20 | #include <QtQuick/private/qquickanimation_p.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | class QQuickParentAnimationPrivate; |
25 | class Q_QUICK_PRIVATE_EXPORT QQuickParentAnimation : public QQuickAnimationGroup |
26 | { |
27 | Q_OBJECT |
28 | Q_DECLARE_PRIVATE(QQuickParentAnimation) |
29 | |
30 | Q_PROPERTY(QQuickItem *target READ target WRITE setTargetObject NOTIFY targetChanged FINAL) |
31 | Q_PROPERTY(QQuickItem *newParent READ newParent WRITE setNewParent NOTIFY newParentChanged FINAL) |
32 | Q_PROPERTY(QQuickItem *via READ via WRITE setVia NOTIFY viaChanged FINAL) |
33 | QML_NAMED_ELEMENT(ParentAnimation) |
34 | QML_ADDED_IN_VERSION(2, 0) |
35 | |
36 | public: |
37 | QQuickParentAnimation(QObject *parent=nullptr); |
38 | |
39 | QQuickItem *target() const; |
40 | void setTargetObject(QQuickItem *); |
41 | |
42 | QQuickItem *newParent() const; |
43 | void setNewParent(QQuickItem *); |
44 | |
45 | QQuickItem *via() const; |
46 | void setVia(QQuickItem *); |
47 | |
48 | Q_SIGNALS: |
49 | void targetChanged(); |
50 | void newParentChanged(); |
51 | void viaChanged(); |
52 | |
53 | protected: |
54 | QAbstractAnimationJob* transition(QQuickStateActions &actions, |
55 | QQmlProperties &modified, |
56 | TransitionDirection direction, |
57 | QObject *defaultTarget = nullptr) override; |
58 | }; |
59 | |
60 | class QQuickAnchorAnimationPrivate; |
61 | class Q_QUICK_PRIVATE_EXPORT QQuickAnchorAnimation : public QQuickAbstractAnimation |
62 | { |
63 | Q_OBJECT |
64 | Q_DECLARE_PRIVATE(QQuickAnchorAnimation) |
65 | Q_PROPERTY(QQmlListProperty<QQuickItem> targets READ targets FINAL) |
66 | Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged FINAL) |
67 | Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged FINAL) |
68 | QML_NAMED_ELEMENT(AnchorAnimation) |
69 | QML_ADDED_IN_VERSION(2, 0) |
70 | |
71 | public: |
72 | QQuickAnchorAnimation(QObject *parent=nullptr); |
73 | |
74 | QQmlListProperty<QQuickItem> targets(); |
75 | |
76 | int duration() const; |
77 | void setDuration(int); |
78 | |
79 | QEasingCurve easing() const; |
80 | void setEasing(const QEasingCurve &); |
81 | |
82 | Q_SIGNALS: |
83 | void durationChanged(int); |
84 | void easingChanged(const QEasingCurve&); |
85 | |
86 | protected: |
87 | QAbstractAnimationJob* transition(QQuickStateActions &actions, |
88 | QQmlProperties &modified, |
89 | TransitionDirection direction, |
90 | QObject *defaultTarget = nullptr) override; |
91 | }; |
92 | |
93 | #if QT_CONFIG(quick_path) |
94 | |
95 | class QQuickItem; |
96 | class QQuickPath; |
97 | class QQuickPathAnimationPrivate; |
98 | class Q_QUICK_PRIVATE_EXPORT QQuickPathAnimation : public QQuickAbstractAnimation |
99 | { |
100 | Q_OBJECT |
101 | Q_DISABLE_COPY_MOVE(QQuickPathAnimation) |
102 | Q_DECLARE_PRIVATE(QQuickPathAnimation) |
103 | |
104 | Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged FINAL) |
105 | Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged FINAL) |
106 | Q_PROPERTY(QQuickPath *path READ path WRITE setPath NOTIFY pathChanged FINAL) |
107 | Q_PROPERTY(QQuickItem *target READ target WRITE setTargetObject NOTIFY targetChanged FINAL) |
108 | Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL) |
109 | Q_PROPERTY(QPointF anchorPoint READ anchorPoint WRITE setAnchorPoint NOTIFY anchorPointChanged FINAL) |
110 | Q_PROPERTY(int orientationEntryDuration READ orientationEntryDuration WRITE setOrientationEntryDuration NOTIFY orientationEntryDurationChanged FINAL) |
111 | Q_PROPERTY(int orientationExitDuration READ orientationExitDuration WRITE setOrientationExitDuration NOTIFY orientationExitDurationChanged FINAL) |
112 | Q_PROPERTY(qreal endRotation READ endRotation WRITE setEndRotation NOTIFY endRotationChanged FINAL) |
113 | QML_NAMED_ELEMENT(PathAnimation) |
114 | QML_ADDED_IN_VERSION(2, 0) |
115 | |
116 | public: |
117 | QQuickPathAnimation(QObject *parent=nullptr); |
118 | virtual ~QQuickPathAnimation(); |
119 | |
120 | enum Orientation { |
121 | Fixed, |
122 | RightFirst, |
123 | LeftFirst, |
124 | BottomFirst, |
125 | TopFirst |
126 | }; |
127 | Q_ENUM(Orientation) |
128 | |
129 | int duration() const; |
130 | void setDuration(int); |
131 | |
132 | QEasingCurve easing() const; |
133 | void setEasing(const QEasingCurve &); |
134 | |
135 | QQuickPath *path() const; |
136 | void setPath(QQuickPath *); |
137 | |
138 | QQuickItem *target() const; |
139 | void setTargetObject(QQuickItem *); |
140 | |
141 | Orientation orientation() const; |
142 | void setOrientation(Orientation orientation); |
143 | |
144 | QPointF anchorPoint() const; |
145 | void setAnchorPoint(const QPointF &point); |
146 | |
147 | int orientationEntryDuration() const; |
148 | void setOrientationEntryDuration(int); |
149 | |
150 | int orientationExitDuration() const; |
151 | void setOrientationExitDuration(int); |
152 | |
153 | qreal endRotation() const; |
154 | void setEndRotation(qreal); |
155 | |
156 | protected: |
157 | QAbstractAnimationJob* transition(QQuickStateActions &actions, |
158 | QQmlProperties &modified, |
159 | TransitionDirection direction, |
160 | QObject *defaultTarget = nullptr) override; |
161 | Q_SIGNALS: |
162 | void durationChanged(int); |
163 | void easingChanged(const QEasingCurve &); |
164 | void pathChanged(); |
165 | void targetChanged(); |
166 | void orientationChanged(Orientation); |
167 | void anchorPointChanged(const QPointF &); |
168 | void orientationEntryDurationChanged(qreal); |
169 | void orientationExitDurationChanged(qreal); |
170 | void endRotationChanged(qreal); |
171 | }; |
172 | |
173 | #endif |
174 | |
175 | QT_END_NAMESPACE |
176 | |
177 | QML_DECLARE_TYPE(QQuickParentAnimation) |
178 | QML_DECLARE_TYPE(QQuickAnchorAnimation) |
179 | #if QT_CONFIG(quick_path) |
180 | QML_DECLARE_TYPE(QQuickPathAnimation) |
181 | #endif |
182 | |
183 | #endif // QQUICKITEMANIMATION_H |
184 | |