Qt
6.x
The Qt SDK
Loading...
Searching...
No Matches
qtmetamacros.h
Go to the documentation of this file.
1
// Copyright (C) 2019 The Qt Company Ltd.
2
// Copyright (C) 2019 Olivier Goffart <ogoffart@woboq.com>
3
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5
#ifndef QTMETAMACROS_H
6
#define QTMETAMACROS_H
7
8
#include <QtCore/qglobal.h>
9
10
QT_BEGIN_NAMESPACE
11
12
#ifndef Q_MOC_OUTPUT_REVISION
13
#define Q_MOC_OUTPUT_REVISION 68
14
#endif
15
16
// The following macros can be defined by tools that understand Qt
17
// to have the information from the macro.
18
#ifndef QT_ANNOTATE_CLASS
19
# define QT_ANNOTATE_CLASS(type, ...)
20
#endif
21
#ifndef QT_ANNOTATE_CLASS2
22
# define QT_ANNOTATE_CLASS2(type, a1, a2)
23
#endif
24
#ifndef QT_ANNOTATE_FUNCTION
25
# define QT_ANNOTATE_FUNCTION(x)
26
#endif
27
#ifndef QT_ANNOTATE_ACCESS_SPECIFIER
28
# define QT_ANNOTATE_ACCESS_SPECIFIER(x)
29
#endif
30
31
// The following macros are our "extensions" to C++
32
// They are used, strictly speaking, only by the moc.
33
34
#ifndef Q_MOC_RUN
35
#ifndef QT_NO_META_MACROS
36
# if defined(QT_NO_KEYWORDS)
37
# define QT_NO_EMIT
38
# else
39
# ifndef QT_NO_SIGNALS_SLOTS_KEYWORDS
40
# define slots Q_SLOTS
41
# define signals Q_SIGNALS
42
# endif
43
# endif
44
# define Q_SLOTS QT_ANNOTATE_ACCESS_SPECIFIER(qt_slot)
45
# define Q_SIGNALS public QT_ANNOTATE_ACCESS_SPECIFIER(qt_signal)
46
# define Q_PRIVATE_SLOT(d, signature) QT_ANNOTATE_CLASS2(qt_private_slot, d, signature)
47
# define Q_EMIT
48
#ifndef QT_NO_EMIT
49
# define emit
50
#endif
51
#ifndef Q_CLASSINFO
52
# define Q_CLASSINFO(name, value)
53
#endif
54
#define Q_PLUGIN_METADATA(x) QT_ANNOTATE_CLASS(qt_plugin_metadata, x)
55
#define Q_INTERFACES(x) QT_ANNOTATE_CLASS(qt_interfaces, x)
56
#define Q_PROPERTY(...) QT_ANNOTATE_CLASS(qt_property, __VA_ARGS__)
57
#define Q_PRIVATE_PROPERTY(d, text) QT_ANNOTATE_CLASS2(qt_private_property, d, text)
58
#ifndef Q_REVISION
59
# define Q_REVISION(...)
60
#endif
61
#define Q_OVERRIDE(text) QT_ANNOTATE_CLASS(qt_override, text)
62
#define QDOC_PROPERTY(text) QT_ANNOTATE_CLASS(qt_qdoc_property, text)
63
#define Q_ENUMS(x) QT_ANNOTATE_CLASS(qt_enums, x)
64
#define Q_FLAGS(x) QT_ANNOTATE_CLASS(qt_enums, x)
65
#define Q_ENUM_IMPL(ENUM) \
66
friend constexpr const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
67
friend constexpr const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
68
#define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x)
69
#define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x)
70
#define Q_ENUM_NS_IMPL(ENUM) \
71
inline constexpr const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
72
inline constexpr const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
73
#define Q_ENUM_NS(x) Q_ENUMS(x) Q_ENUM_NS_IMPL(x)
74
#define Q_FLAG_NS(x) Q_FLAGS(x) Q_ENUM_NS_IMPL(x)
75
#define Q_SCRIPTABLE QT_ANNOTATE_FUNCTION(qt_scriptable)
76
#define Q_INVOKABLE QT_ANNOTATE_FUNCTION(qt_invokable)
77
#define Q_SIGNAL QT_ANNOTATE_FUNCTION(qt_signal)
78
#define Q_SLOT QT_ANNOTATE_FUNCTION(qt_slot)
79
#define Q_MOC_INCLUDE(...) QT_ANNOTATE_CLASS(qt_moc_include, __VA_ARGS__)
80
#endif
// QT_NO_META_MACROS
81
82
#ifndef QT_NO_TRANSLATION
83
// full set of tr functions
84
# define QT_TR_FUNCTIONS \
85
static inline QString tr(const char *s, const char *c = nullptr, int n = -1) \
86
{ return staticMetaObject.tr(s, c, n); }
87
#else
88
// inherit the ones from QObject
89
# define QT_TR_FUNCTIONS
90
#endif
91
92
#ifdef Q_QDOC
93
#define QT_TR_FUNCTIONS
94
#endif
95
96
#define Q_DECL_HIDDEN_STATIC_METACALL Q_DECL_HIDDEN
97
98
#if defined(Q_CC_CLANG)
99
# if Q_CC_CLANG >= 1100
100
# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_CLANG("-Winconsistent-missing-override"
) QT_WARNING_DISABLE_CLANG("-Wsuggest-override")
101
# elif Q_CC_CLANG >= 306
102
# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_CLANG("-Winconsistent-missing-override"
)
103
# endif
104
#elif defined(Q_CC_GNU) && Q_CC_GNU >= 501
105
# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_GCC("-Wsuggest-override"
)
106
#else
107
# define Q_OBJECT_NO_OVERRIDE_WARNING
108
#endif
109
110
#if defined(Q_CC_GNU) && Q_CC_GNU >= 600
111
# define Q_OBJECT_NO_ATTRIBUTES_WARNING QT_WARNING_DISABLE_GCC("-Wattributes"
)
112
#else
113
# define Q_OBJECT_NO_ATTRIBUTES_WARNING
114
#endif
115
116
/* qmake ignore Q_OBJECT */
117
#define Q_OBJECT \
118
public: \
119
QT_WARNING_PUSH \
120
Q_OBJECT_NO_OVERRIDE_WARNING \
121
static const QMetaObject staticMetaObject; \
122
virtual const QMetaObject *metaObject() const; \
123
virtual void *qt_metacast(const char *); \
124
virtual int qt_metacall(QMetaObject::Call, int, void **); \
125
QT_TR_FUNCTIONS \
126
private: \
127
Q_OBJECT_NO_ATTRIBUTES_WARNING \
128
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
129
QT_WARNING_POP \
130
struct QPrivateSignal { explicit QPrivateSignal() = default; }; \
131
QT_ANNOTATE_CLASS(qt_qobject, ""
)
132
133
/* qmake ignore Q_OBJECT */
134
#define Q_OBJECT_FAKE Q_OBJECT QT_ANNOTATE_CLASS(qt_fake, ""
)
135
136
#ifndef QT_NO_META_MACROS
137
/* qmake ignore Q_GADGET_EXPORT */
138
#define Q_GADGET_EXPORT(...) \
139
public: \
140
static __VA_ARGS__ const QMetaObject staticMetaObject; \
141
void qt_check_for_QGADGET_macro(); \
142
typedef void QtGadgetHelper; \
143
private: \
144
QT_WARNING_PUSH \
145
Q_OBJECT_NO_ATTRIBUTES_WARNING \
146
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
147
QT_WARNING_POP \
148
QT_ANNOTATE_CLASS(qt_qgadget, ""
) \
149
/*end*/
150
151
/* qmake ignore Q_GADGET */
152
#define Q_GADGET Q_GADGET_EXPORT()
153
154
/* qmake ignore Q_NAMESPACE_EXPORT */
155
#define Q_NAMESPACE_EXPORT(...) \
156
extern __VA_ARGS__ const QMetaObject staticMetaObject; \
157
QT_ANNOTATE_CLASS(qt_qnamespace, ""
) \
158
/*end*/
159
160
/* qmake ignore Q_NAMESPACE */
161
#define Q_NAMESPACE Q_NAMESPACE_EXPORT() \
162
/*end*/
163
164
#endif
// QT_NO_META_MACROS
165
166
#else
// Q_MOC_RUN
167
#define slots slots
168
#define signals signals
169
#define Q_SLOTS Q_SLOTS
170
#define Q_SIGNALS Q_SIGNALS
171
#define Q_CLASSINFO(name, value) Q_CLASSINFO(name, value)
172
#define Q_INTERFACES(x) Q_INTERFACES(x)
173
#define Q_PROPERTY(text) Q_PROPERTY(text)
174
#define Q_PRIVATE_PROPERTY(d, text) Q_PRIVATE_PROPERTY(d, text)
175
#define Q_PRIVATE_QPROPERTY(accessor, type, name, setter, ...) Q_PRIVATE_QPROPERTY(accessor, type, name, setter, __VA_ARGS__)
176
#define Q_PRIVATE_QPROPERTIES_BEGIN
177
#define Q_PRIVATE_QPROPERTY_IMPL(name)
178
#define Q_PRIVATE_QPROPERTIES_END
179
#define Q_REVISION(...) Q_REVISION(__VA_ARGS__)
180
#define Q_OVERRIDE(text) Q_OVERRIDE(text)
181
#define Q_ENUMS(x) Q_ENUMS(x)
182
#define Q_FLAGS(x) Q_FLAGS(x)
183
#define Q_ENUM(x) Q_ENUM(x)
184
#define Q_FLAGS(x) Q_FLAGS(x)
185
/* qmake ignore Q_OBJECT */
186
#define Q_OBJECT Q_OBJECT
187
/* qmake ignore Q_OBJECT */
188
#define Q_OBJECT_FAKE Q_OBJECT_FAKE
189
/* qmake ignore Q_GADGET */
190
#define Q_GADGET Q_GADGET
191
#define Q_SCRIPTABLE Q_SCRIPTABLE
192
#define Q_INVOKABLE Q_INVOKABLE
193
#define Q_SIGNAL Q_SIGNAL
194
#define Q_SLOT Q_SLOT
195
#endif
//Q_MOC_RUN
196
197
QT_END_NAMESPACE
198
199
#endif
// QTMETAMACROS_H
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1545
qtbase
src
corelib
kernel
qtmetamacros.h
Generated by
1.9.7