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 QQUICKSTATEOPERATIONS_P_H |
41 | #define QQUICKSTATEOPERATIONS_P_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 | #include "qquickanchors_p.h" |
56 | |
57 | #include <QtQuick/private/qquickstate_p.h> |
58 | |
59 | #include <QtQml/qqmlscriptstring.h> |
60 | |
61 | QT_BEGIN_NAMESPACE |
62 | |
63 | class QQuickParentChangePrivate; |
64 | class Q_AUTOTEST_EXPORT QQuickParentChange : public QQuickStateOperation, public QQuickStateActionEvent |
65 | { |
66 | Q_OBJECT |
67 | Q_DECLARE_PRIVATE(QQuickParentChange) |
68 | |
69 | Q_PROPERTY(QQuickItem *target READ object WRITE setObject) |
70 | Q_PROPERTY(QQuickItem *parent READ parent WRITE setParent) |
71 | Q_PROPERTY(QQmlScriptString x READ x WRITE setX) |
72 | Q_PROPERTY(QQmlScriptString y READ y WRITE setY) |
73 | Q_PROPERTY(QQmlScriptString width READ width WRITE setWidth) |
74 | Q_PROPERTY(QQmlScriptString height READ height WRITE setHeight) |
75 | Q_PROPERTY(QQmlScriptString scale READ scale WRITE setScale) |
76 | Q_PROPERTY(QQmlScriptString rotation READ rotation WRITE setRotation) |
77 | QML_NAMED_ELEMENT(ParentChange) |
78 | public: |
79 | QQuickParentChange(QObject *parent=nullptr); |
80 | ~QQuickParentChange(); |
81 | |
82 | QQuickItem *object() const; |
83 | void setObject(QQuickItem *); |
84 | |
85 | QQuickItem *parent() const; |
86 | void setParent(QQuickItem *); |
87 | |
88 | QQuickItem *originalParent() const; |
89 | |
90 | QQmlScriptString x() const; |
91 | void setX(const QQmlScriptString &x); |
92 | bool xIsSet() const; |
93 | |
94 | QQmlScriptString y() const; |
95 | void setY(const QQmlScriptString &y); |
96 | bool yIsSet() const; |
97 | |
98 | QQmlScriptString width() const; |
99 | void setWidth(const QQmlScriptString &width); |
100 | bool widthIsSet() const; |
101 | |
102 | QQmlScriptString height() const; |
103 | void setHeight(const QQmlScriptString &height); |
104 | bool heightIsSet() const; |
105 | |
106 | QQmlScriptString scale() const; |
107 | void setScale(const QQmlScriptString &scale); |
108 | bool scaleIsSet() const; |
109 | |
110 | QQmlScriptString rotation() const; |
111 | void setRotation(const QQmlScriptString &rotation); |
112 | bool rotationIsSet() const; |
113 | |
114 | ActionList actions() override; |
115 | |
116 | void saveOriginals() override; |
117 | //virtual void copyOriginals(QQuickStateActionEvent*); |
118 | void execute() override; |
119 | bool isReversable() override; |
120 | void reverse() override; |
121 | EventType type() const override; |
122 | bool mayOverride(QQuickStateActionEvent*other) override; |
123 | void rewind() override; |
124 | void saveCurrentValues() override; |
125 | }; |
126 | |
127 | class QQuickAnchorChanges; |
128 | class QQuickAnchorSetPrivate; |
129 | class Q_AUTOTEST_EXPORT QQuickAnchorSet : public QObject |
130 | { |
131 | Q_OBJECT |
132 | |
133 | Q_PROPERTY(QQmlScriptString left READ left WRITE setLeft RESET resetLeft) |
134 | Q_PROPERTY(QQmlScriptString right READ right WRITE setRight RESET resetRight) |
135 | Q_PROPERTY(QQmlScriptString horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter) |
136 | Q_PROPERTY(QQmlScriptString top READ top WRITE setTop RESET resetTop) |
137 | Q_PROPERTY(QQmlScriptString bottom READ bottom WRITE setBottom RESET resetBottom) |
138 | Q_PROPERTY(QQmlScriptString verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter) |
139 | Q_PROPERTY(QQmlScriptString baseline READ baseline WRITE setBaseline RESET resetBaseline) |
140 | QML_ANONYMOUS |
141 | |
142 | public: |
143 | QQuickAnchorSet(QObject *parent=nullptr); |
144 | virtual ~QQuickAnchorSet(); |
145 | |
146 | QQmlScriptString left() const; |
147 | void setLeft(const QQmlScriptString &edge); |
148 | void resetLeft(); |
149 | |
150 | QQmlScriptString right() const; |
151 | void setRight(const QQmlScriptString &edge); |
152 | void resetRight(); |
153 | |
154 | QQmlScriptString horizontalCenter() const; |
155 | void setHorizontalCenter(const QQmlScriptString &edge); |
156 | void resetHorizontalCenter(); |
157 | |
158 | QQmlScriptString top() const; |
159 | void setTop(const QQmlScriptString &edge); |
160 | void resetTop(); |
161 | |
162 | QQmlScriptString bottom() const; |
163 | void setBottom(const QQmlScriptString &edge); |
164 | void resetBottom(); |
165 | |
166 | QQmlScriptString verticalCenter() const; |
167 | void setVerticalCenter(const QQmlScriptString &edge); |
168 | void resetVerticalCenter(); |
169 | |
170 | QQmlScriptString baseline() const; |
171 | void setBaseline(const QQmlScriptString &edge); |
172 | void resetBaseline(); |
173 | |
174 | QQuickAnchors::Anchors usedAnchors() const; |
175 | |
176 | private: |
177 | friend class QQuickAnchorChanges; |
178 | Q_DISABLE_COPY(QQuickAnchorSet) |
179 | Q_DECLARE_PRIVATE(QQuickAnchorSet) |
180 | }; |
181 | |
182 | class QQuickAnchorChangesPrivate; |
183 | class Q_AUTOTEST_EXPORT QQuickAnchorChanges : public QQuickStateOperation, public QQuickStateActionEvent |
184 | { |
185 | Q_OBJECT |
186 | Q_DECLARE_PRIVATE(QQuickAnchorChanges) |
187 | |
188 | Q_PROPERTY(QQuickItem *target READ object WRITE setObject) |
189 | Q_PROPERTY(QQuickAnchorSet *anchors READ anchors CONSTANT) |
190 | QML_NAMED_ELEMENT(AnchorChanges) |
191 | |
192 | public: |
193 | QQuickAnchorChanges(QObject *parent=nullptr); |
194 | ~QQuickAnchorChanges(); |
195 | |
196 | ActionList actions() override; |
197 | |
198 | QQuickAnchorSet *anchors() const; |
199 | |
200 | QQuickItem *object() const; |
201 | void setObject(QQuickItem *); |
202 | |
203 | void execute() override; |
204 | bool isReversable() override; |
205 | void reverse() override; |
206 | EventType type() const override; |
207 | bool mayOverride(QQuickStateActionEvent*other) override; |
208 | bool changesBindings() override; |
209 | void saveOriginals() override; |
210 | bool needsCopy() override { return true; } |
211 | void copyOriginals(QQuickStateActionEvent*) override; |
212 | void clearBindings() override; |
213 | void rewind() override; |
214 | void saveCurrentValues() override; |
215 | |
216 | QList<QQuickStateAction> additionalActions() const; |
217 | void saveTargetValues() override; |
218 | }; |
219 | |
220 | QT_END_NAMESPACE |
221 | |
222 | QML_DECLARE_TYPE(QQuickParentChange) |
223 | QML_DECLARE_TYPE(QQuickAnchorSet) |
224 | QML_DECLARE_TYPE(QQuickAnchorChanges) |
225 | |
226 | #endif // QQUICKSTATEOPERATIONS_P_H |
227 | |
228 |