1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtQuick module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QQUICKITEMANIMATION_H
41#define QQUICKITEMANIMATION_H
42
43//
44// W A R N I N G
45// -------------
46//
47// This file is not part of the Qt API. It exists purely as an
48// implementation detail. This header file may change from version to
49// version without notice, or even be removed.
50//
51// We mean it.
52//
53
54#include "qquickitem.h"
55
56#include <QtQuick/private/qquickanimation_p.h>
57
58QT_BEGIN_NAMESPACE
59
60class QQuickParentAnimationPrivate;
61class Q_AUTOTEST_EXPORT QQuickParentAnimation : public QQuickAnimationGroup
62{
63 Q_OBJECT
64 Q_DECLARE_PRIVATE(QQuickParentAnimation)
65
66 Q_PROPERTY(QQuickItem *target READ target WRITE setTargetObject NOTIFY targetChanged)
67 Q_PROPERTY(QQuickItem *newParent READ newParent WRITE setNewParent NOTIFY newParentChanged)
68 Q_PROPERTY(QQuickItem *via READ via WRITE setVia NOTIFY viaChanged)
69 QML_NAMED_ELEMENT(ParentAnimation)
70
71public:
72 QQuickParentAnimation(QObject *parent=nullptr);
73 virtual ~QQuickParentAnimation();
74
75 QQuickItem *target() const;
76 void setTargetObject(QQuickItem *);
77
78 QQuickItem *newParent() const;
79 void setNewParent(QQuickItem *);
80
81 QQuickItem *via() const;
82 void setVia(QQuickItem *);
83
84Q_SIGNALS:
85 void targetChanged();
86 void newParentChanged();
87 void viaChanged();
88
89protected:
90 QAbstractAnimationJob* transition(QQuickStateActions &actions,
91 QQmlProperties &modified,
92 TransitionDirection direction,
93 QObject *defaultTarget = nullptr) override;
94};
95
96class QQuickAnchorAnimationPrivate;
97class Q_AUTOTEST_EXPORT QQuickAnchorAnimation : public QQuickAbstractAnimation
98{
99 Q_OBJECT
100 Q_DECLARE_PRIVATE(QQuickAnchorAnimation)
101 Q_PROPERTY(QQmlListProperty<QQuickItem> targets READ targets)
102 Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
103 Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged)
104 QML_NAMED_ELEMENT(AnchorAnimation)
105
106public:
107 QQuickAnchorAnimation(QObject *parent=nullptr);
108 virtual ~QQuickAnchorAnimation();
109
110 QQmlListProperty<QQuickItem> targets();
111
112 int duration() const;
113 void setDuration(int);
114
115 QEasingCurve easing() const;
116 void setEasing(const QEasingCurve &);
117
118Q_SIGNALS:
119 void durationChanged(int);
120 void easingChanged(const QEasingCurve&);
121
122protected:
123 QAbstractAnimationJob* transition(QQuickStateActions &actions,
124 QQmlProperties &modified,
125 TransitionDirection direction,
126 QObject *defaultTarget = nullptr) override;
127};
128
129#if QT_CONFIG(quick_path)
130
131class QQuickItem;
132class QQuickPath;
133class QQuickPathAnimationPrivate;
134class Q_AUTOTEST_EXPORT QQuickPathAnimation : public QQuickAbstractAnimation
135{
136 Q_OBJECT
137 Q_DECLARE_PRIVATE(QQuickPathAnimation)
138
139 Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
140 Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged)
141 Q_PROPERTY(QQuickPath *path READ path WRITE setPath NOTIFY pathChanged)
142 Q_PROPERTY(QQuickItem *target READ target WRITE setTargetObject NOTIFY targetChanged)
143 Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
144 Q_PROPERTY(QPointF anchorPoint READ anchorPoint WRITE setAnchorPoint NOTIFY anchorPointChanged)
145 Q_PROPERTY(int orientationEntryDuration READ orientationEntryDuration WRITE setOrientationEntryDuration NOTIFY orientationEntryDurationChanged)
146 Q_PROPERTY(int orientationExitDuration READ orientationExitDuration WRITE setOrientationExitDuration NOTIFY orientationExitDurationChanged)
147 Q_PROPERTY(qreal endRotation READ endRotation WRITE setEndRotation NOTIFY endRotationChanged)
148 QML_NAMED_ELEMENT(PathAnimation)
149
150public:
151 QQuickPathAnimation(QObject *parent=nullptr);
152 virtual ~QQuickPathAnimation();
153
154 enum Orientation {
155 Fixed,
156 RightFirst,
157 LeftFirst,
158 BottomFirst,
159 TopFirst
160 };
161 Q_ENUM(Orientation)
162
163 int duration() const;
164 void setDuration(int);
165
166 QEasingCurve easing() const;
167 void setEasing(const QEasingCurve &);
168
169 QQuickPath *path() const;
170 void setPath(QQuickPath *);
171
172 QQuickItem *target() const;
173 void setTargetObject(QQuickItem *);
174
175 Orientation orientation() const;
176 void setOrientation(Orientation orientation);
177
178 QPointF anchorPoint() const;
179 void setAnchorPoint(const QPointF &point);
180
181 int orientationEntryDuration() const;
182 void setOrientationEntryDuration(int);
183
184 int orientationExitDuration() const;
185 void setOrientationExitDuration(int);
186
187 qreal endRotation() const;
188 void setEndRotation(qreal);
189
190protected:
191 QAbstractAnimationJob* transition(QQuickStateActions &actions,
192 QQmlProperties &modified,
193 TransitionDirection direction,
194 QObject *defaultTarget = nullptr) override;
195Q_SIGNALS:
196 void durationChanged(int);
197 void easingChanged(const QEasingCurve &);
198 void pathChanged();
199 void targetChanged();
200 void orientationChanged(Orientation);
201 void anchorPointChanged(const QPointF &);
202 void orientationEntryDurationChanged(qreal);
203 void orientationExitDurationChanged(qreal);
204 void endRotationChanged(qreal);
205};
206
207#endif
208
209QT_END_NAMESPACE
210
211QML_DECLARE_TYPE(QQuickParentAnimation)
212QML_DECLARE_TYPE(QQuickAnchorAnimation)
213#if QT_CONFIG(quick_path)
214QML_DECLARE_TYPE(QQuickPathAnimation)
215#endif
216
217#endif // QQUICKITEMANIMATION_H
218

source code of qtdeclarative/src/quick/items/qquickitemanimation_p.h