OpenCoverage

qqmlvaluetype_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqmlvaluetype_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
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 QtQml 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 QQMLVALUETYPE_P_H-
41#define QQMLVALUETYPE_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 "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-
64QT_BEGIN_NAMESPACE-
65-
66class Q_QML_PRIVATE_EXPORT QQmlValueType : public QObject, public QAbstractDynamicMetaObject-
67{-
68public:-
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 // ---- dynamic meta object data interface-
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-
82private:-
83 const QMetaObject *_metaObject;-
84 void *gadgetPtr;-
85-
86public:-
87 int typeId;-
88 QMetaType metaType;-
89};-
90-
91class Q_QML_PRIVATE_EXPORT QQmlValueTypeFactory-
92{-
93public:-
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-
101struct 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-
107public:-
108 Q_INVOKABLE QString toString() const;-
109 qreal x() const;-
110 qreal y() const;-
111 void setX(qreal);-
112 void setY(qreal);-
113};-
114-
115struct 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-
121public:-
122 int x() const;-
123 int y() const;-
124 void setX(int);-
125 void setY(int);-
126};-
127-
128struct 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-
134public:-
135 Q_INVOKABLE QString toString() const;-
136 qreal width() const;-
137 qreal height() const;-
138 void setWidth(qreal);-
139 void setHeight(qreal);-
140};-
141-
142struct 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-
148public:-
149 int width() const;-
150 int height() const;-
151 void setWidth(int);-
152 void setHeight(int);-
153};-
154-
155struct 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-
167public:-
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-
185struct 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-
197public:-
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-
214struct 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)-
224public:-
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-
265template<typename T>-
266int 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-
294QT_END_NAMESPACE-
295-
296#endif // QQMLVALUETYPE_P_H-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0