OpenCoverage

qqml.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/qml/qqml.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 QQML_H-
41#define QQML_H-
42-
43#include <QtQml/qqmlprivate.h>-
44#include <QtQml/qqmlparserstatus.h>-
45#include <QtQml/qqmlpropertyvaluesource.h>-
46#include <QtQml/qqmllist.h>-
47-
48#include <QtCore/qbytearray.h>-
49#include <QtCore/qmetaobject.h>-
50-
51#define QML_VERSION 0x020000-
52#define QML_VERSION_STR "2.0"-
53-
54#define QML_DECLARE_TYPE(TYPE) \-
55 Q_DECLARE_METATYPE(TYPE *) \-
56 Q_DECLARE_METATYPE(QQmlListProperty<TYPE>)-
57-
58#define QML_DECLARE_TYPE_HASMETATYPE(TYPE) \-
59 Q_DECLARE_METATYPE(QQmlListProperty<TYPE>)-
60-
61#define QML_DECLARE_INTERFACE(INTERFACE) \-
62 QML_DECLARE_TYPE(INTERFACE)-
63-
64#define QML_DECLARE_INTERFACE_HASMETATYPE(INTERFACE) \-
65 QML_DECLARE_TYPE_HASMETATYPE(INTERFACE)-
66-
67enum { /* TYPEINFO flags */-
68 QML_HAS_ATTACHED_PROPERTIES = 0x01-
69};-
70-
71#define QML_DECLARE_TYPEINFO(TYPE, FLAGS) \-
72QT_BEGIN_NAMESPACE \-
73template <> \-
74class QQmlTypeInfo<TYPE > \-
75{ \-
76public: \-
77 enum { \-
78 hasAttachedProperties = (((FLAGS) & QML_HAS_ATTACHED_PROPERTIES) == QML_HAS_ATTACHED_PROPERTIES) \-
79 }; \-
80}; \-
81QT_END_NAMESPACE-
82-
83QT_BEGIN_NAMESPACE-
84-
85-
86class QQmlPropertyValueInterceptor;-
87-
88#define QML_GETTYPENAMES \-
89 const char *className = T::staticMetaObject.className(); \-
90 const int nameLen = int(strlen(className)); \-
91 QVarLengthArray<char,48> pointerName(nameLen+2); \-
92 memcpy(pointerName.data(), className, size_t(nameLen)); \-
93 pointerName[nameLen] = '*'; \-
94 pointerName[nameLen+1] = '\0'; \-
95 const int listLen = int(strlen("QQmlListProperty<")); \-
96 QVarLengthArray<char,64> listName(listLen + nameLen + 2); \-
97 memcpy(listName.data(), "QQmlListProperty<", size_t(listLen)); \-
98 memcpy(listName.data()+listLen, className, size_t(nameLen)); \-
99 listName[listLen+nameLen] = '>'; \-
100 listName[listLen+nameLen+1] = '\0';-
101-
102void Q_QML_EXPORT qmlClearTypeRegistrations();-
103-
104template<typename T>-
105int qmlRegisterType()-
106{-
107 QML_GETTYPENAMES-
108-
109 QQmlPrivate::RegisterType type = {-
110 0,-
111-
112 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
113 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
114 0,-
115 nullptr,-
116 QString(),-
117-
118 nullptr, 0, 0, nullptr, &T::staticMetaObject,-
119-
120 QQmlPrivate::attachedPropertiesFunc<T>(),-
121 QQmlPrivate::attachedPropertiesMetaObject<T>(),-
122-
123 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
124 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
125 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
126-
127 nullptr, nullptr,-
128-
129 nullptr,-
130 0-
131 };-
132-
133 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
executed 9172 times by 134 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
  • ...
9172
134}-
135-
136int Q_QML_EXPORT qmlRegisterTypeNotAvailable(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& message);-
137-
138template<typename T>-
139int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason)-
140{-
141 QML_GETTYPENAMES-
142-
143 QQmlPrivate::RegisterType type = {-
144 0,-
145-
146 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
147 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
148 0,-
149 nullptr,-
150 reason,-
151-
152 uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,-
153-
154 QQmlPrivate::attachedPropertiesFunc<T>(),-
155 QQmlPrivate::attachedPropertiesMetaObject<T>(),-
156-
157 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
158 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
159 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
160-
161 nullptr, nullptr,-
162-
163 nullptr,-
164 0-
165 };-
166-
167 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
executed 6784 times by 135 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
  • ...
6784
168}-
169-
170template<typename T, int metaObjectRevision>-
171int qmlRegisterUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason)-
172{-
173 QML_GETTYPENAMES-
174-
175 QQmlPrivate::RegisterType type = {-
176 1,-
177-
178 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
179 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
180 0,-
181 nullptr,-
182 reason,-
183-
184 uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,-
185-
186 QQmlPrivate::attachedPropertiesFunc<T>(),-
187 QQmlPrivate::attachedPropertiesMetaObject<T>(),-
188-
189 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
190 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
191 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
192-
193 nullptr, nullptr,-
194-
195 nullptr,-
196 metaObjectRevision-
197 };-
198-
199 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
executed 3576 times by 134 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
  • ...
3576
200}-
201-
202template<typename T, typename E>-
203int qmlRegisterExtendedUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason)-
204{-
205 QML_GETTYPENAMES-
206-
207 QQmlAttachedPropertiesFunc attached = QQmlPrivate::attachedPropertiesFunc<E>();-
208 const QMetaObject * attachedMetaObject = QQmlPrivate::attachedPropertiesMetaObject<E>();-
209 if (!attached) {
!attachedDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
0-2
210 attached = QQmlPrivate::attachedPropertiesFunc<T>();-
211 attachedMetaObject = QQmlPrivate::attachedPropertiesMetaObject<T>();-
212 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qqmlecmascript
2
213-
214 QQmlPrivate::RegisterType type = {-
215 0,-
216-
217 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
218 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
219 0,-
220 nullptr,-
221 reason,-
222-
223 uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,-
224-
225 attached,-
226 attachedMetaObject,-
227-
228 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
229 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
230 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
231-
232 QQmlPrivate::createParent<E>, &E::staticMetaObject,-
233-
234 nullptr,-
235 0-
236 };-
237-
238 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
executed 2 times by 1 test: return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
Executed by:
  • tst_qqmlecmascript
2
239}-
240-
241template<typename T, typename E, int metaObjectRevision>-
242int qmlRegisterExtendedUncreatableType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason)-
243{-
244 QML_GETTYPENAMES-
245-
246 QQmlAttachedPropertiesFunc attached = QQmlPrivate::attachedPropertiesFunc<E>();-
247 const QMetaObject * attachedMetaObject = QQmlPrivate::attachedPropertiesMetaObject<E>();-
248 if (!attached) {
!attachedDescription
TRUEnever evaluated
FALSEnever evaluated
0
249 attached = QQmlPrivate::attachedPropertiesFunc<T>();-
250 attachedMetaObject = QQmlPrivate::attachedPropertiesMetaObject<T>();-
251 }
never executed: end of block
0
252-
253 QQmlPrivate::RegisterType type = {-
254 1,-
255-
256 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
257 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
258 0,-
259 nullptr,-
260 reason,-
261-
262 uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,-
263-
264 attached,-
265 attachedMetaObject,-
266-
267 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
268 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
269 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
270-
271 QQmlPrivate::createParent<E>, &E::staticMetaObject,-
272-
273 nullptr,-
274 metaObjectRevision-
275 };-
276-
277 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
never executed: return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
0
278}-
279-
280Q_QML_EXPORT int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject, const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason);-
281-
282template<typename T>-
283int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)-
284{-
285 QML_GETTYPENAMES-
286-
287 QQmlPrivate::RegisterType type = {-
288 0,-
289-
290 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
291 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
292 sizeof(T), QQmlPrivate::createInto<T>,-
293 QString(),-
294-
295 uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,-
296-
297 QQmlPrivate::attachedPropertiesFunc<T>(),-
298 QQmlPrivate::attachedPropertiesMetaObject<T>(),-
299-
300 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
301 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
302 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
303-
304 nullptr, nullptr,-
305-
306 nullptr,-
307 0-
308 };-
309-
310 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
executed 38610 times by 138 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_qqmlitemmodels
  • tst_qqmllistmodel
  • tst_qqmllistmodelworkerscript
  • ...
38610
311}-
312-
313template<typename T, int metaObjectRevision>-
314int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)-
315{-
316 QML_GETTYPENAMES-
317-
318 QQmlPrivate::RegisterType type = {-
319 1,-
320-
321 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
322 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
323 sizeof(T), QQmlPrivate::createInto<T>,-
324 QString(),-
325-
326 uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,-
327-
328 QQmlPrivate::attachedPropertiesFunc<T>(),-
329 QQmlPrivate::attachedPropertiesMetaObject<T>(),-
330-
331 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
332 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
333 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
334-
335 nullptr, nullptr,-
336-
337 nullptr,-
338 metaObjectRevision-
339 };-
340-
341 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
executed 18728 times by 136 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
  • ...
18728
342}-
343-
344template<typename T, int metaObjectRevision>-
345int qmlRegisterRevision(const char *uri, int versionMajor, int versionMinor)-
346{-
347 QML_GETTYPENAMES-
348-
349 QQmlPrivate::RegisterType type = {-
350 1,-
351-
352 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
353 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
354 sizeof(T), QQmlPrivate::createInto<T>,-
355 QString(),-
356-
357 uri, versionMajor, versionMinor, nullptr, &T::staticMetaObject,-
358-
359 QQmlPrivate::attachedPropertiesFunc<T>(),-
360 QQmlPrivate::attachedPropertiesMetaObject<T>(),-
361-
362 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
363 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
364 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
365-
366 nullptr, nullptr,-
367-
368 nullptr,-
369 metaObjectRevision-
370 };-
371-
372 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
executed 240 times by 23 tests: return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
Executed by:
  • tst_examples
  • tst_qqmlcomponent
  • tst_qqmlecmascript
  • tst_qqmlenginecleanup
  • tst_qquickanimationcontroller
  • tst_qquickanimations
  • tst_qquickcanvasitem
  • tst_qquickitem
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickloader
  • tst_qquickmousearea
  • tst_qquickrepeater
  • tst_qquickscreen
  • tst_qquickshortcut
  • tst_qquicktableview
  • tst_qquicktext
  • tst_qquickview
  • tst_qquickwindow
  • tst_quicktestmainwithsetup
  • tst_scenegraph
  • tst_testfiltering
240
373}-
374-
375-
376template<typename T, typename E>-
377int qmlRegisterExtendedType()-
378{-
379 QML_GETTYPENAMES-
380-
381 QQmlPrivate::RegisterType type = {-
382 0,-
383-
384 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
385 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
386 0,-
387 nullptr,-
388 QString(),-
389-
390 nullptr, 0, 0, nullptr, &T::staticMetaObject,-
391-
392 QQmlPrivate::attachedPropertiesFunc<T>(),-
393 QQmlPrivate::attachedPropertiesMetaObject<T>(),-
394-
395 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
396 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
397 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
398-
399 QQmlPrivate::createParent<E>, &E::staticMetaObject,-
400-
401 nullptr,-
402 0-
403 };-
404-
405 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
never executed: return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
0
406}-
407-
408template<typename T, typename E>-
409int qmlRegisterExtendedType(const char *uri, int versionMajor, int versionMinor,-
410 const char *qmlName)-
411{-
412 QML_GETTYPENAMES-
413-
414 QQmlAttachedPropertiesFunc attached = QQmlPrivate::attachedPropertiesFunc<E>();-
415 const QMetaObject * attachedMetaObject = QQmlPrivate::attachedPropertiesMetaObject<E>();-
416 if (!attached) {
!attachedDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qqmlecmascript
FALSEnever evaluated
0-8
417 attached = QQmlPrivate::attachedPropertiesFunc<T>();-
418 attachedMetaObject = QQmlPrivate::attachedPropertiesMetaObject<T>();-
419 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_qqmlecmascript
8
420-
421 QQmlPrivate::RegisterType type = {-
422 0,-
423-
424 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
425 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
426 sizeof(T), QQmlPrivate::createInto<T>,-
427 QString(),-
428-
429 uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,-
430-
431 attached,-
432 attachedMetaObject,-
433-
434 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
435 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
436 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
437-
438 QQmlPrivate::createParent<E>, &E::staticMetaObject,-
439-
440 nullptr,-
441 0-
442 };-
443-
444 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
executed 8 times by 1 test: return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
Executed by:
  • tst_qqmlecmascript
8
445}-
446-
447template<typename T>-
448int qmlRegisterInterface(const char *typeName)-
449{-
450 QByteArray name(typeName);-
451-
452 QByteArray pointerName(name + '*');-
453 QByteArray listName("QQmlListProperty<" + name + '>');-
454-
455 QQmlPrivate::RegisterInterface qmlInterface = {-
456 0,-
457-
458 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
459 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
460-
461 qobject_interface_iid<T *>()-
462 };-
463-
464 return QQmlPrivate::qmlregister(QQmlPrivate::InterfaceRegistration, &qmlInterface);
never executed: return QQmlPrivate::qmlregister(QQmlPrivate::InterfaceRegistration, &qmlInterface);
0
465}-
466-
467template<typename T>-
468int qmlRegisterCustomType(const char *uri, int versionMajor, int versionMinor,-
469 const char *qmlName, QQmlCustomParser *parser)-
470{-
471 QML_GETTYPENAMES-
472-
473 QQmlPrivate::RegisterType type = {-
474 0,-
475-
476 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
477 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
478 sizeof(T), QQmlPrivate::createInto<T>,-
479 QString(),-
480-
481 uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,-
482-
483 QQmlPrivate::attachedPropertiesFunc<T>(),-
484 QQmlPrivate::attachedPropertiesMetaObject<T>(),-
485-
486 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
487 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
488 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
489-
490 nullptr, nullptr,-
491-
492 parser,-
493 0-
494 };-
495-
496 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
executed 382 times by 135 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
  • ...
382
497}-
498-
499template<typename T, typename E>-
500int qmlRegisterCustomExtendedType(const char *uri, int versionMajor, int versionMinor,-
501 const char *qmlName, QQmlCustomParser *parser)-
502{-
503 QML_GETTYPENAMES-
504-
505 QQmlAttachedPropertiesFunc attached = QQmlPrivate::attachedPropertiesFunc<E>();-
506 const QMetaObject * attachedMetaObject = QQmlPrivate::attachedPropertiesMetaObject<E>();-
507 if (!attached) {
!attachedDescription
TRUEnever evaluated
FALSEnever evaluated
0
508 attached = QQmlPrivate::attachedPropertiesFunc<T>();-
509 attachedMetaObject = QQmlPrivate::attachedPropertiesMetaObject<T>();-
510 }
never executed: end of block
0
511-
512 QQmlPrivate::RegisterType type = {-
513 0,-
514-
515 qRegisterNormalizedMetaType<T *>(pointerName.constData()),-
516 qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData()),-
517 sizeof(T), QQmlPrivate::createInto<T>,-
518 QString(),-
519-
520 uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject,-
521-
522 attached,-
523 attachedMetaObject,-
524-
525 QQmlPrivate::StaticCastSelector<T,QQmlParserStatus>::cast(),-
526 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueSource>::cast(),-
527 QQmlPrivate::StaticCastSelector<T,QQmlPropertyValueInterceptor>::cast(),-
528-
529 QQmlPrivate::createParent<E>, &E::staticMetaObject,-
530-
531 parser,-
532 0-
533 };-
534-
535 return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
never executed: return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
0
536}-
537-
538class QQmlContext;-
539class QQmlEngine;-
540class QJSValue;-
541class QJSEngine;-
542-
543#ifndef Q_QDOC-
544namespace QtQml {-
545#endif-
546 // declared in namespace to avoid symbol conflicts with QtDeclarative-
547 Q_QML_EXPORT void qmlExecuteDeferred(QObject *);-
548 Q_QML_EXPORT QQmlContext *qmlContext(const QObject *);-
549 Q_QML_EXPORT QQmlEngine *qmlEngine(const QObject *);-
550 Q_QML_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);-
551 Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *, const QObject *,-
552 const QMetaObject *, bool create);-
553#ifndef Q_QDOC-
554}-
555#endif-
556-
557QT_WARNING_PUSH-
558QT_WARNING_DISABLE_CLANG("-Wheader-hygiene")-
559-
560// This is necessary to allow for QtQuick1 and QtQuick2 scenes in a single application.-
561using namespace QtQml;-
562-
563QT_WARNING_POP-
564-
565//The C++ version of protected namespaces in qmldir-
566Q_QML_EXPORT bool qmlProtectModule(const char* uri, int majVersion);-
567Q_QML_EXPORT void qmlRegisterModule(const char *uri, int versionMajor, int versionMinor);-
568-
569template<typename T>-
570QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true)-
571{-
572 static int idx = -1;-
573 return qmlAttachedPropertiesObject(&idx, obj, &T::staticMetaObject, create);
executed 387221 times by 33 tests: return qmlAttachedPropertiesObject(&idx, obj, &T::staticMetaObject, create);
Executed by:
  • tst_examples
  • tst_flickableinterop
  • tst_qqmlecmascript
  • tst_qqmllistmodel
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickaccessible
  • tst_qquickanchors
  • tst_qquickanimations
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickfocusscope
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquickitem2
  • tst_qquickitemlayer
  • tst_qquickitemparticle
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickmultipointtoucharea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • ...
387221
574}-
575-
576Q_QML_EXPORT void qmlRegisterBaseTypes(const char *uri, int versionMajor, int versionMinor);-
577-
578inline int qmlRegisterSingletonType(const char *uri, int versionMajor, int versionMinor, const char *typeName,-
579 QJSValue (*callback)(QQmlEngine *, QJSEngine *))-
580{-
581 QQmlPrivate::RegisterSingletonType api = {-
582 0,-
583-
584 uri, versionMajor, versionMinor, typeName,-
585-
586 callback, nullptr, nullptr, 0, 0-
587 };-
588-
589 return QQmlPrivate::qmlregister(QQmlPrivate::SingletonRegistration, &api);
executed 6 times by 1 test: return QQmlPrivate::qmlregister(QQmlPrivate::SingletonRegistration, &api);
Executed by:
  • tst_qqmlecmascript
6
590}-
591-
592enum { QmlCurrentSingletonTypeRegistrationVersion = 2 };-
593template <typename T>-
594inline int qmlRegisterSingletonType(const char *uri, int versionMajor, int versionMinor, const char *typeName,-
595 QObject *(*callback)(QQmlEngine *, QJSEngine *))-
596{-
597 QML_GETTYPENAMES-
598-
599 QQmlPrivate::RegisterSingletonType api = {-
600 QmlCurrentSingletonTypeRegistrationVersion,-
601-
602 uri, versionMajor, versionMinor, typeName,-
603-
604 nullptr, callback, &T::staticMetaObject, qRegisterNormalizedMetaType<T *>(pointerName.constData()), 0-
605 };-
606-
607 return QQmlPrivate::qmlregister(QQmlPrivate::SingletonRegistration, &api);
executed 70 times by 11 tests: return QQmlPrivate::qmlregister(QQmlPrivate::SingletonRegistration, &api);
Executed by:
  • tst_examples
  • tst_qqmlconnections
  • tst_qqmlecmascript
  • tst_qqmlmetatype
  • tst_qqmlqt
  • tst_qqmlsqldatabase
  • tst_qquickanimationcontroller
  • tst_qquickcanvasitem
  • tst_qquicklayouts
  • tst_quicktestmainwithsetup
  • tst_testfiltering
70
608}-
609-
610inline int qmlRegisterSingletonType(const QUrl &url, const char *uri, int versionMajor, int versionMinor, const char *qmlName)-
611{-
612 if (url.isRelative()) {
url.isRelative()Description
TRUEnever evaluated
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • tst_qmldiskcache
  • tst_qqmlcontext
  • tst_qqmltypeloader
0-6
613 // User input check must go here, because QQmlPrivate::qmlregister is also used internally for composite types-
614 qWarning("qmlRegisterSingletonType requires absolute URLs.");-
615 return 0;
never executed: return 0;
0
616 }-
617-
618 QQmlPrivate::RegisterCompositeSingletonType type = {-
619 url,-
620 uri,-
621 versionMajor,-
622 versionMinor,-
623 qmlName-
624 };-
625-
626 return QQmlPrivate::qmlregister(QQmlPrivate::CompositeSingletonRegistration, &type);
executed 6 times by 3 tests: return QQmlPrivate::qmlregister(QQmlPrivate::CompositeSingletonRegistration, &type);
Executed by:
  • tst_qmldiskcache
  • tst_qqmlcontext
  • tst_qqmltypeloader
6
627}-
628-
629inline int qmlRegisterType(const QUrl &url, const char *uri, int versionMajor, int versionMinor, const char *qmlName)-
630{-
631 if (url.isRelative()) {
url.isRelative()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qqmlmetatype
0-4
632 // User input check must go here, because QQmlPrivate::qmlregister is also used internally for composite types-
633 qWarning("qmlRegisterType requires absolute URLs.");-
634 return 0;
never executed: return 0;
0
635 }-
636-
637 QQmlPrivate::RegisterCompositeType type = {-
638 url,-
639 uri,-
640 versionMajor,-
641 versionMinor,-
642 qmlName-
643 };-
644-
645 return QQmlPrivate::qmlregister(QQmlPrivate::CompositeRegistration, &type);
executed 4 times by 1 test: return QQmlPrivate::qmlregister(QQmlPrivate::CompositeRegistration, &type);
Executed by:
  • tst_qqmlmetatype
4
646}-
647-
648int Q_QML_EXPORT qmlTypeId(const char *uri, int versionMajor, int versionMinor, const char *qmlName);-
649-
650QT_END_NAMESPACE-
651-
652QML_DECLARE_TYPE(QObject)-
653Q_DECLARE_METATYPE(QVariant)-
654-
655#endif // QQML_H-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0