Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmlbuiltins_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQMLBUILTINS_H
5#define QQMLBUILTINS_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18// QmlBuiltins does not link QtQml - rather the other way around. Still, we can use the QtQml
19// headers here. This works because we explicitly include the QtQml include directories in the
20// manual moc call.
21#include <private/qqmlcomponentattached_p.h>
22#include <QtQml/qjsvalue.h>
23#include <QtQml/qqmlcomponent.h>
24#include <QtQml/qqmlscriptstring.h>
25
26#include <QtQmlIntegration/qqmlintegration.h>
27
28#include <QtCore/qobject.h>
29#include <QtCore/qglobal.h>
30#include <QtCore/qtmetamacros.h>
31#include <QtCore/qmetaobject.h>
32#include <QtCore/qdatetime.h>
33#include <QtCore/qstring.h>
34#include <QtCore/qurl.h>
35#include <QtCore/qvariantmap.h>
36#include <QtCore/qtypes.h>
37#include <QtCore/qchar.h>
38#include <QtCore/qjsonobject.h>
39
40#include <climits>
41
42#if QT_CONFIG(regularexpression)
43#include <QtCore/qregularexpression.h>
44#endif
45
47
48// moc doesn't do 64bit constants, so we have to determine the size of qsizetype indirectly.
49// We assume that qsizetype is always the same size as a pointer. I haven't seen a platform
50// where this is not the case.
51// Furthermore moc is wrong about pretty much everything on 64bit windows. We need to hardcode
52// the size there.
53// Likewise, we also have to determine the size of long and ulong indirectly.
54
55#if defined(Q_OS_WIN64)
56
57static_assert(sizeof(long) == 4);
58#define QML_LONG_IS_32BIT
59static_assert(sizeof(qsizetype) == 8);
60#define QML_SIZE_IS_64BIT
61
62#elif QT_POINTER_SIZE == 4
63
64static_assert(sizeof(long) == 4);
65#define QML_LONG_IS_32BIT
66static_assert(sizeof(qsizetype) == 4);
67#define QML_SIZE_IS_32BIT
68
69#else
70
71static_assert(sizeof(long) == 8);
72#define QML_LONG_IS_64BIT
73static_assert(sizeof(qsizetype) == 8);
74#define QML_SIZE_IS_64BIT
75
76#endif
77
78#define QML_EXTENDED_JAVASCRIPT(EXTENDED_TYPE) \
79 Q_CLASSINFO("QML.Extended", #EXTENDED_TYPE) \
80 Q_CLASSINFO("QML.ExtensionIsJavaScript", "true")
81
82template<typename A> struct QQmlPrimitiveAliasFriend {};
83
84#define QML_PRIMITIVE_ALIAS(PRIMITIVE_ALIAS) \
85 Q_CLASSINFO("QML.PrimitiveAlias", #PRIMITIVE_ALIAS) \
86 friend QQmlPrimitiveAliasFriend<PRIMITIVE_ALIAS>;
87
89{
91 QML_VALUE_TYPE(void)
93#if !QT_CONFIG(regularexpression)
94 QML_VALUE_TYPE(regexp)
95#endif
96 QML_FOREIGN(void)
97};
98
107
116
118{
120 QML_VALUE_TYPE(int)
122 QML_FOREIGN(int)
124 QML_PRIMITIVE_ALIAS(int32_t)
125#ifdef QML_SIZE_IS_32BIT
127#endif
128#ifdef QML_LONG_IS_32BIT
130#endif
131};
132
134{
136 QML_VALUE_TYPE(real)
137 QML_VALUE_TYPE(double)
139 QML_FOREIGN(double)
140#if !defined(QT_COORD_TYPE) || defined(QT_COORD_TYPE_IS_DOUBLE)
142#endif
143};
144
146{
148 QML_VALUE_TYPE(string)
151};
152
160
162{
164 QML_VALUE_TYPE(bool)
166 QML_FOREIGN(bool)
167};
168
176
184
185#if QT_CONFIG(regularexpression)
186struct QQmlRegexpForeign
187{
189 QML_VALUE_TYPE(regexp)
192};
193#endif
194
196{
199 QML_FOREIGN(std::nullptr_t)
201};
202
210
212{
217 QML_PRIMITIVE_ALIAS(int8_t)
218#if CHAR_MAX == SCHAR_MAX
220#endif
221};
222
224{
229 QML_PRIMITIVE_ALIAS(uint8_t)
231#if CHAR_MAX == UCHAR_MAX
233#endif
234};
235
245
255
257{
263 QML_PRIMITIVE_ALIAS(uint32_t)
264#ifdef QML_LONG_IS_32BIT
266#endif
267};
268
270{
276 QML_PRIMITIVE_ALIAS(int64_t)
277#ifdef QML_LONG_IS_64BIT
279#endif
280#ifdef QML_SIZE_IS_64BIT
282#endif
283};
284
286{
292 QML_PRIMITIVE_ALIAS(uint64_t)
293#ifdef QML_LONG_IS_64BIT
295#endif
296};
297
299{
303 QML_FOREIGN(float)
304#if defined(QT_COORD_TYPE) && defined(QT_COORD_TYPE_IS_FLOAT)
306#endif
307};
308
316
324
332
340
348
356
365
373
381
388
396
404
406
407#endif // QQMLBUILTINS_H
Definition main.cpp:8
\inmodule QtCore
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
\inmodule QtCore\reentrant
Definition qdatetime.h:283
\inmodule QtCore \reentrant
Definition qdatetime.h:29
The QJSValue class acts as a container for Qt/JavaScript data types.
Definition qjsvalue.h:31
\inmodule QtCore\reentrant
Definition qjsonobject.h:20
\inmodule QtCore
Definition qobject.h:103
The QQmlComponent class encapsulates a QML component definition.
The QQmlScriptString class encapsulates a script and its context.
\inmodule QtCore \reentrant
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore \reentrant
Definition qdatetime.h:215
\inmodule QtCore
Definition qurl.h:94
\inmodule QtCore
Definition qvariant.h:65
QDate date
[1]
Combined button and popup list for selecting options.
#define QML_PRIMITIVE_ALIAS(PRIMITIVE_ALIAS)
#define QML_EXTENDED_JAVASCRIPT(EXTENDED_TYPE)
#define QML_ANONYMOUS
#define QML_SEQUENTIAL_CONTAINER(VALUE_TYPE)
#define QML_EXTENDED(EXTENDED_TYPE)
#define QML_VALUE_TYPE(NAME)
#define QML_NAMED_ELEMENT(NAME)
#define QML_FOREIGN(FOREIGN_TYPE)
#define QML_ATTACHED(ATTACHED_TYPE)
#define Q_CLASSINFO(name, value)
#define Q_GADGET
unsigned int quint32
Definition qtypes.h:50
unsigned char uchar
Definition qtypes.h:32
short qint16
Definition qtypes.h:47
unsigned short quint16
Definition qtypes.h:48
int qint32
Definition qtypes.h:49
unsigned long ulong
Definition qtypes.h:35
quint64 qulonglong
Definition qtypes.h:64
unsigned long long quint64
Definition qtypes.h:61
ptrdiff_t qsizetype
Definition qtypes.h:165
unsigned int uint
Definition qtypes.h:34
long long qint64
Definition qtypes.h:60
unsigned short ushort
Definition qtypes.h:33
QT_BEGIN_NAMESPACE typedef signed char qint8
Definition qtypes.h:45
double qreal
Definition qtypes.h:187
unsigned char quint8
Definition qtypes.h:46
qint64 qlonglong
Definition qtypes.h:63
QUrl url("example.com")
[constructor-url-reference]
QVariant variant
[1]