Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | #ifndef QQMLVALUETYPE_P_H | - |
41 | #define QQMLVALUETYPE_P_H | - |
42 | | - |
43 | | - |
44 | | - |
45 | | - |
46 | | - |
47 | | - |
48 | | - |
49 | | - |
50 | | - |
51 | | - |
52 | | - |
53 | | - |
54 | #include "qqml.h" | - |
55 | #include "qqmlproperty.h" | - |
56 | #include "qqmlproperty_p.h" | - |
57 | #include <private/qqmlnullablevalue_p.h> | - |
58 | | - |
59 | #include <QtCore/qobject.h> | - |
60 | #include <QtCore/qrect.h> | - |
61 | #include <QtCore/qeasingcurve.h> | - |
62 | #include <QtCore/qvariant.h> | - |
63 | | - |
64 | QT_BEGIN_NAMESPACE | - |
65 | | - |
66 | class Q_QML_PRIVATE_EXPORT QQmlValueType : public QObject, public QAbstractDynamicMetaObject | - |
67 | { | - |
68 | public: | - |
69 | QQmlValueType(int userType, const QMetaObject *metaObject); | - |
70 | ~QQmlValueType() override; | - |
71 | void read(QObject *, int); | - |
72 | void write(QObject *, int, QQmlPropertyData::WriteFlags flags); | - |
73 | QVariant value(); | - |
74 | void setValue(const QVariant &); | - |
75 | | - |
76 | | - |
77 | QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *) override; | - |
78 | void objectDestroyed(QObject *) override; | - |
79 | int metaCall(QObject *obj, QMetaObject::Call type, int _id, void **argv) override; | - |
80 | | - |
81 | | - |
82 | private: | - |
83 | const QMetaObject *_metaObject; | - |
84 | void *gadgetPtr; | - |
85 | | - |
86 | public: | - |
87 | int typeId; | - |
88 | QMetaType metaType; | - |
89 | }; | - |
90 | | - |
91 | class Q_QML_PRIVATE_EXPORT QQmlValueTypeFactory | - |
92 | { | - |
93 | public: | - |
94 | static bool isValueType(int); | - |
95 | static QQmlValueType *valueType(int idx); | - |
96 | static const QMetaObject *metaObjectForMetaType(int type); | - |
97 | | - |
98 | static void registerValueTypes(const char *uri, int versionMajor, int versionMinor); | - |
99 | }; | - |
100 | | - |
101 | struct QQmlPointFValueType | - |
102 | { | - |
103 | QPointF v; | - |
104 | Q_PROPERTY(qreal x READ x WRITE setX FINAL) | - |
105 | Q_PROPERTY(qreal y READ y WRITE setY FINAL) | - |
106 | Q_GADGET | - |
107 | public: | - |
108 | Q_INVOKABLE QString toString() const; | - |
109 | qreal x() const; | - |
110 | qreal y() const; | - |
111 | void setX(qreal); | - |
112 | void setY(qreal); | - |
113 | }; | - |
114 | | - |
115 | struct QQmlPointValueType | - |
116 | { | - |
117 | QPoint v; | - |
118 | Q_PROPERTY(int x READ x WRITE setX FINAL) | - |
119 | Q_PROPERTY(int y READ y WRITE setY FINAL) | - |
120 | Q_GADGET | - |
121 | public: | - |
122 | int x() const; | - |
123 | int y() const; | - |
124 | void setX(int); | - |
125 | void setY(int); | - |
126 | }; | - |
127 | | - |
128 | struct QQmlSizeFValueType | - |
129 | { | - |
130 | QSizeF v; | - |
131 | Q_PROPERTY(qreal width READ width WRITE setWidth FINAL) | - |
132 | Q_PROPERTY(qreal height READ height WRITE setHeight FINAL) | - |
133 | Q_GADGET | - |
134 | public: | - |
135 | Q_INVOKABLE QString toString() const; | - |
136 | qreal width() const; | - |
137 | qreal height() const; | - |
138 | void setWidth(qreal); | - |
139 | void setHeight(qreal); | - |
140 | }; | - |
141 | | - |
142 | struct QQmlSizeValueType | - |
143 | { | - |
144 | QSize v; | - |
145 | Q_PROPERTY(int width READ width WRITE setWidth FINAL) | - |
146 | Q_PROPERTY(int height READ height WRITE setHeight FINAL) | - |
147 | Q_GADGET | - |
148 | public: | - |
149 | int width() const; | - |
150 | int height() const; | - |
151 | void setWidth(int); | - |
152 | void setHeight(int); | - |
153 | }; | - |
154 | | - |
155 | struct QQmlRectFValueType | - |
156 | { | - |
157 | QRectF v; | - |
158 | Q_PROPERTY(qreal x READ x WRITE setX FINAL) | - |
159 | Q_PROPERTY(qreal y READ y WRITE setY FINAL) | - |
160 | Q_PROPERTY(qreal width READ width WRITE setWidth FINAL) | - |
161 | Q_PROPERTY(qreal height READ height WRITE setHeight FINAL) | - |
162 | Q_PROPERTY(qreal left READ left DESIGNABLE false FINAL) | - |
163 | Q_PROPERTY(qreal right READ right DESIGNABLE false FINAL) | - |
164 | Q_PROPERTY(qreal top READ top DESIGNABLE false FINAL) | - |
165 | Q_PROPERTY(qreal bottom READ bottom DESIGNABLE false FINAL) | - |
166 | Q_GADGET | - |
167 | public: | - |
168 | Q_INVOKABLE QString toString() const; | - |
169 | qreal x() const; | - |
170 | qreal y() const; | - |
171 | void setX(qreal); | - |
172 | void setY(qreal); | - |
173 | | - |
174 | qreal width() const; | - |
175 | qreal height() const; | - |
176 | void setWidth(qreal); | - |
177 | void setHeight(qreal); | - |
178 | | - |
179 | qreal left() const; | - |
180 | qreal right() const; | - |
181 | qreal top() const; | - |
182 | qreal bottom() const; | - |
183 | }; | - |
184 | | - |
185 | struct QQmlRectValueType | - |
186 | { | - |
187 | QRect v; | - |
188 | Q_PROPERTY(int x READ x WRITE setX FINAL) | - |
189 | Q_PROPERTY(int y READ y WRITE setY FINAL) | - |
190 | Q_PROPERTY(int width READ width WRITE setWidth FINAL) | - |
191 | Q_PROPERTY(int height READ height WRITE setHeight FINAL) | - |
192 | Q_PROPERTY(int left READ left DESIGNABLE false FINAL) | - |
193 | Q_PROPERTY(int right READ right DESIGNABLE false FINAL) | - |
194 | Q_PROPERTY(int top READ top DESIGNABLE false FINAL) | - |
195 | Q_PROPERTY(int bottom READ bottom DESIGNABLE false FINAL) | - |
196 | Q_GADGET | - |
197 | public: | - |
198 | int x() const; | - |
199 | int y() const; | - |
200 | void setX(int); | - |
201 | void setY(int); | - |
202 | | - |
203 | int width() const; | - |
204 | int height() const; | - |
205 | void setWidth(int); | - |
206 | void setHeight(int); | - |
207 | | - |
208 | int left() const; | - |
209 | int right() const; | - |
210 | int top() const; | - |
211 | int bottom() const; | - |
212 | }; | - |
213 | | - |
214 | struct QQmlEasingValueType | - |
215 | { | - |
216 | QEasingCurve v; | - |
217 | Q_GADGET | - |
218 | | - |
219 | Q_PROPERTY(QQmlEasingValueType::Type type READ type WRITE setType FINAL) | - |
220 | Q_PROPERTY(qreal amplitude READ amplitude WRITE setAmplitude FINAL) | - |
221 | Q_PROPERTY(qreal overshoot READ overshoot WRITE setOvershoot FINAL) | - |
222 | Q_PROPERTY(qreal period READ period WRITE setPeriod FINAL) | - |
223 | Q_PROPERTY(QVariantList bezierCurve READ bezierCurve WRITE setBezierCurve FINAL) | - |
224 | public: | - |
225 | enum Type { | - |
226 | Linear = QEasingCurve::Linear, | - |
227 | InQuad = QEasingCurve::InQuad, OutQuad = QEasingCurve::OutQuad, | - |
228 | InOutQuad = QEasingCurve::InOutQuad, OutInQuad = QEasingCurve::OutInQuad, | - |
229 | InCubic = QEasingCurve::InCubic, OutCubic = QEasingCurve::OutCubic, | - |
230 | InOutCubic = QEasingCurve::InOutCubic, OutInCubic = QEasingCurve::OutInCubic, | - |
231 | InQuart = QEasingCurve::InQuart, OutQuart = QEasingCurve::OutQuart, | - |
232 | InOutQuart = QEasingCurve::InOutQuart, OutInQuart = QEasingCurve::OutInQuart, | - |
233 | InQuint = QEasingCurve::InQuint, OutQuint = QEasingCurve::OutQuint, | - |
234 | InOutQuint = QEasingCurve::InOutQuint, OutInQuint = QEasingCurve::OutInQuint, | - |
235 | InSine = QEasingCurve::InSine, OutSine = QEasingCurve::OutSine, | - |
236 | InOutSine = QEasingCurve::InOutSine, OutInSine = QEasingCurve::OutInSine, | - |
237 | InExpo = QEasingCurve::InExpo, OutExpo = QEasingCurve::OutExpo, | - |
238 | InOutExpo = QEasingCurve::InOutExpo, OutInExpo = QEasingCurve::OutInExpo, | - |
239 | InCirc = QEasingCurve::InCirc, OutCirc = QEasingCurve::OutCirc, | - |
240 | InOutCirc = QEasingCurve::InOutCirc, OutInCirc = QEasingCurve::OutInCirc, | - |
241 | InElastic = QEasingCurve::InElastic, OutElastic = QEasingCurve::OutElastic, | - |
242 | InOutElastic = QEasingCurve::InOutElastic, OutInElastic = QEasingCurve::OutInElastic, | - |
243 | InBack = QEasingCurve::InBack, OutBack = QEasingCurve::OutBack, | - |
244 | InOutBack = QEasingCurve::InOutBack, OutInBack = QEasingCurve::OutInBack, | - |
245 | InBounce = QEasingCurve::InBounce, OutBounce = QEasingCurve::OutBounce, | - |
246 | InOutBounce = QEasingCurve::InOutBounce, OutInBounce = QEasingCurve::OutInBounce, | - |
247 | InCurve = QEasingCurve::InCurve, OutCurve = QEasingCurve::OutCurve, | - |
248 | SineCurve = QEasingCurve::SineCurve, CosineCurve = QEasingCurve::CosineCurve, | - |
249 | Bezier = QEasingCurve::BezierSpline | - |
250 | }; | - |
251 | Q_ENUM(Type) | - |
252 | | - |
253 | Type type() const; | - |
254 | qreal amplitude() const; | - |
255 | qreal overshoot() const; | - |
256 | qreal period() const; | - |
257 | void setType(Type); | - |
258 | void setAmplitude(qreal); | - |
259 | void setOvershoot(qreal); | - |
260 | void setPeriod(qreal); | - |
261 | void setBezierCurve(const QVariantList &); | - |
262 | QVariantList bezierCurve() const; | - |
263 | }; | - |
264 | | - |
265 | template<typename T> | - |
266 | int qmlRegisterValueTypeEnums(const char *uri, int versionMajor, int versionMinor, const char *qmlName) | - |
267 | { | - |
268 | QByteArray name(T::staticMetaObject.className()); | - |
269 | | - |
270 | QByteArray pointerName(name + '*'); | - |
271 | | - |
272 | QQmlPrivate::RegisterType type = { | - |
273 | 0, | - |
274 | | - |
275 | qRegisterNormalizedMetaType<T *>(pointerName.constData()), 0, 0, nullptr, | - |
276 | | - |
277 | QString(), | - |
278 | | - |
279 | uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject, | - |
280 | | - |
281 | nullptr, nullptr, | - |
282 | | - |
283 | 0, 0, 0, | - |
284 | | - |
285 | nullptr, nullptr, | - |
286 | | - |
287 | nullptr, | - |
288 | 0 | - |
289 | }; | - |
290 | | - |
291 | return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);executed 752 times by 133 tests: return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type); Executed by:- tst_bindingdependencyapi
- tst_drawingmodes
- tst_examples
- tst_flickableinterop
- tst_multipointtoucharea_interop
- tst_parserstress
- tst_qmlcachegen
- tst_qmldiskcache
- tst_qqmlbinding
- tst_qqmlcomponent
- tst_qqmlconnections
- tst_qqmlconsole
- tst_qqmlcontext
- tst_qqmldebugjs
- tst_qqmlecmascript
- tst_qqmlenginecleanup
- tst_qqmlenginedebugservice
- tst_qqmlexpression
- tst_qqmlimport
- tst_qqmlincubator
- tst_qqmlinfo
- tst_qqmlinstantiator
- tst_qqmllistmodel
- tst_qqmllistmodelworkerscript
- tst_qqmllistreference
- ...
| 752 |
292 | } | - |
293 | | - |
294 | QT_END_NAMESPACE | - |
295 | | - |
296 | #endif // QQMLVALUETYPE_P_H | - |
| | |