Use Q_NAMESPACE for the Qt namespace, and remove the old moc hack to support it
Since I can't #include qobjectdefs from qnamespace because of circular dependency, move the Qt macro in the qtmetamacros.h header. Deprecate QObject::staticQtMetaObject since now one can just use Qt::staticMetaObject Change-Id: I11982aa17c2afa2067486b113f8052672f3695eb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>bb10
parent
b0498b1864
commit
cedf0207d1
|
|
@ -41,6 +41,7 @@
|
|||
#define QNAMESPACE_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qtmetamacros.h>
|
||||
|
||||
#if defined(__OBJC__) && !defined(__cplusplus)
|
||||
# warning "File built in Objective-C mode (.m), but using Qt requires Objective-C++ (.mm)"
|
||||
|
|
@ -48,29 +49,10 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if !defined(Q_QDOC) && !defined(Q_MOC_RUN)
|
||||
struct QMetaObject;
|
||||
const QMetaObject *qt_getQtMetaObject() noexcept; // defined in qobject.h (which can't be included here)
|
||||
#define QT_Q_ENUM(ENUM) \
|
||||
inline const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return qt_getQtMetaObject(); } \
|
||||
inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
|
||||
#define QT_Q_FLAG(ENUM) QT_Q_ENUM(ENUM)
|
||||
#else
|
||||
#define QT_Q_ENUM Q_ENUM
|
||||
#define QT_Q_FLAG Q_FLAG
|
||||
#endif
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
namespace
|
||||
#else
|
||||
class Q_CORE_EXPORT
|
||||
#endif
|
||||
Qt {
|
||||
|
||||
#if defined(Q_MOC_RUN)
|
||||
Q_OBJECT
|
||||
public:
|
||||
#endif
|
||||
namespace Qt {
|
||||
Q_NAMESPACE_EXPORT(Q_CORE_EXPORT)
|
||||
|
||||
enum GlobalColor {
|
||||
color0,
|
||||
|
|
@ -1767,102 +1749,96 @@ public:
|
|||
};
|
||||
|
||||
#ifndef Q_QDOC
|
||||
// NOTE: Generally, do not add QT_Q_ENUM if a corresponding Q_Q_FLAG exists.
|
||||
QT_Q_ENUM(ScrollBarPolicy)
|
||||
QT_Q_ENUM(FocusPolicy)
|
||||
QT_Q_ENUM(ContextMenuPolicy)
|
||||
QT_Q_ENUM(ArrowType)
|
||||
QT_Q_ENUM(ToolButtonStyle)
|
||||
QT_Q_ENUM(PenStyle)
|
||||
QT_Q_ENUM(PenCapStyle)
|
||||
QT_Q_ENUM(PenJoinStyle)
|
||||
QT_Q_ENUM(BrushStyle)
|
||||
QT_Q_ENUM(FillRule)
|
||||
QT_Q_ENUM(MaskMode)
|
||||
QT_Q_ENUM(BGMode)
|
||||
QT_Q_ENUM(ClipOperation)
|
||||
QT_Q_ENUM(SizeMode)
|
||||
QT_Q_ENUM(Axis)
|
||||
QT_Q_ENUM(Corner)
|
||||
QT_Q_ENUM(Edge)
|
||||
QT_Q_ENUM(LayoutDirection)
|
||||
QT_Q_ENUM(SizeHint)
|
||||
QT_Q_ENUM(Orientation)
|
||||
QT_Q_ENUM(DropAction)
|
||||
QT_Q_FLAG(Alignment)
|
||||
QT_Q_ENUM(TextFlag)
|
||||
QT_Q_FLAG(Orientations)
|
||||
QT_Q_FLAG(SplitBehavior)
|
||||
QT_Q_FLAG(DropActions)
|
||||
QT_Q_FLAG(Edges)
|
||||
QT_Q_FLAG(DockWidgetAreas)
|
||||
QT_Q_FLAG(ToolBarAreas)
|
||||
QT_Q_ENUM(DockWidgetArea)
|
||||
QT_Q_ENUM(ToolBarArea)
|
||||
QT_Q_ENUM(TextFormat)
|
||||
QT_Q_ENUM(TextElideMode)
|
||||
QT_Q_ENUM(DateFormat)
|
||||
QT_Q_ENUM(TimeSpec)
|
||||
QT_Q_ENUM(DayOfWeek)
|
||||
QT_Q_ENUM(CursorShape)
|
||||
QT_Q_ENUM(GlobalColor)
|
||||
QT_Q_ENUM(AspectRatioMode)
|
||||
QT_Q_ENUM(TransformationMode)
|
||||
QT_Q_FLAG(ImageConversionFlags)
|
||||
QT_Q_ENUM(Key)
|
||||
QT_Q_ENUM(ShortcutContext)
|
||||
QT_Q_ENUM(TextInteractionFlag)
|
||||
QT_Q_FLAG(TextInteractionFlags)
|
||||
QT_Q_ENUM(ItemSelectionMode)
|
||||
QT_Q_ENUM(ItemSelectionOperation)
|
||||
QT_Q_FLAG(ItemFlags)
|
||||
QT_Q_ENUM(CheckState)
|
||||
QT_Q_ENUM(ItemDataRole)
|
||||
QT_Q_ENUM(SortOrder)
|
||||
QT_Q_ENUM(CaseSensitivity)
|
||||
QT_Q_FLAG(MatchFlags)
|
||||
QT_Q_FLAG(KeyboardModifiers)
|
||||
QT_Q_FLAG(MouseButtons)
|
||||
QT_Q_ENUM(WindowType)
|
||||
QT_Q_ENUM(WindowState)
|
||||
QT_Q_ENUM(WindowModality)
|
||||
QT_Q_ENUM(WidgetAttribute)
|
||||
QT_Q_ENUM(ApplicationAttribute)
|
||||
QT_Q_FLAG(WindowFlags)
|
||||
QT_Q_FLAG(WindowStates)
|
||||
QT_Q_ENUM(FocusReason)
|
||||
QT_Q_ENUM(InputMethodHint)
|
||||
QT_Q_ENUM(InputMethodQuery)
|
||||
QT_Q_FLAG(InputMethodHints)
|
||||
QT_Q_ENUM(EnterKeyType)
|
||||
QT_Q_FLAG(InputMethodQueries)
|
||||
QT_Q_FLAG(TouchPointStates)
|
||||
QT_Q_ENUM(ScreenOrientation)
|
||||
QT_Q_FLAG(ScreenOrientations)
|
||||
QT_Q_ENUM(ConnectionType)
|
||||
QT_Q_ENUM(ApplicationState)
|
||||
// NOTE: Generally, do not add Q_ENUM_NS if a corresponding Q_FLAG_NS exists.
|
||||
Q_ENUM_NS(ScrollBarPolicy)
|
||||
Q_ENUM_NS(FocusPolicy)
|
||||
Q_ENUM_NS(ContextMenuPolicy)
|
||||
Q_ENUM_NS(ArrowType)
|
||||
Q_ENUM_NS(ToolButtonStyle)
|
||||
Q_ENUM_NS(PenStyle)
|
||||
Q_ENUM_NS(PenCapStyle)
|
||||
Q_ENUM_NS(PenJoinStyle)
|
||||
Q_ENUM_NS(BrushStyle)
|
||||
Q_ENUM_NS(FillRule)
|
||||
Q_ENUM_NS(MaskMode)
|
||||
Q_ENUM_NS(BGMode)
|
||||
Q_ENUM_NS(ClipOperation)
|
||||
Q_ENUM_NS(SizeMode)
|
||||
Q_ENUM_NS(Axis)
|
||||
Q_ENUM_NS(Corner)
|
||||
Q_ENUM_NS(Edge)
|
||||
Q_ENUM_NS(LayoutDirection)
|
||||
Q_ENUM_NS(SizeHint)
|
||||
Q_ENUM_NS(Orientation)
|
||||
Q_ENUM_NS(DropAction)
|
||||
Q_FLAG_NS(Alignment)
|
||||
Q_ENUM_NS(TextFlag)
|
||||
Q_FLAG_NS(Orientations)
|
||||
Q_FLAG_NS(SplitBehavior)
|
||||
Q_FLAG_NS(DropActions)
|
||||
Q_FLAG_NS(Edges)
|
||||
Q_FLAG_NS(DockWidgetAreas)
|
||||
Q_FLAG_NS(ToolBarAreas)
|
||||
Q_ENUM_NS(DockWidgetArea)
|
||||
Q_ENUM_NS(ToolBarArea)
|
||||
Q_ENUM_NS(TextFormat)
|
||||
Q_ENUM_NS(TextElideMode)
|
||||
Q_ENUM_NS(DateFormat)
|
||||
Q_ENUM_NS(TimeSpec)
|
||||
Q_ENUM_NS(DayOfWeek)
|
||||
Q_ENUM_NS(CursorShape)
|
||||
Q_ENUM_NS(GlobalColor)
|
||||
Q_ENUM_NS(AspectRatioMode)
|
||||
Q_ENUM_NS(TransformationMode)
|
||||
Q_FLAG_NS(ImageConversionFlags)
|
||||
Q_ENUM_NS(Key)
|
||||
Q_ENUM_NS(ShortcutContext)
|
||||
Q_ENUM_NS(TextInteractionFlag)
|
||||
Q_FLAG_NS(TextInteractionFlags)
|
||||
Q_ENUM_NS(ItemSelectionMode)
|
||||
Q_ENUM_NS(ItemSelectionOperation)
|
||||
Q_FLAG_NS(ItemFlags)
|
||||
Q_ENUM_NS(CheckState)
|
||||
Q_ENUM_NS(ItemDataRole)
|
||||
Q_ENUM_NS(SortOrder)
|
||||
Q_ENUM_NS(CaseSensitivity)
|
||||
Q_FLAG_NS(MatchFlags)
|
||||
Q_FLAG_NS(KeyboardModifiers)
|
||||
Q_FLAG_NS(MouseButtons)
|
||||
Q_ENUM_NS(WindowType)
|
||||
Q_ENUM_NS(WindowState)
|
||||
Q_ENUM_NS(WindowModality)
|
||||
Q_ENUM_NS(WidgetAttribute)
|
||||
Q_ENUM_NS(ApplicationAttribute)
|
||||
Q_FLAG_NS(WindowFlags)
|
||||
Q_FLAG_NS(WindowStates)
|
||||
Q_ENUM_NS(FocusReason)
|
||||
Q_ENUM_NS(InputMethodHint)
|
||||
Q_ENUM_NS(InputMethodQuery)
|
||||
Q_FLAG_NS(InputMethodHints)
|
||||
Q_ENUM_NS(EnterKeyType)
|
||||
Q_FLAG_NS(InputMethodQueries)
|
||||
Q_FLAG_NS(TouchPointStates)
|
||||
Q_ENUM_NS(ScreenOrientation)
|
||||
Q_FLAG_NS(ScreenOrientations)
|
||||
Q_ENUM_NS(ConnectionType)
|
||||
Q_ENUM_NS(ApplicationState)
|
||||
#ifndef QT_NO_GESTURES
|
||||
QT_Q_ENUM(GestureState)
|
||||
QT_Q_ENUM(GestureType)
|
||||
QT_Q_ENUM(NativeGestureType)
|
||||
Q_ENUM_NS(GestureState)
|
||||
Q_ENUM_NS(GestureType)
|
||||
Q_ENUM_NS(NativeGestureType)
|
||||
#endif
|
||||
QT_Q_ENUM(CursorMoveStyle)
|
||||
QT_Q_ENUM(TimerType)
|
||||
QT_Q_ENUM(ScrollPhase)
|
||||
QT_Q_ENUM(MouseEventSource)
|
||||
QT_Q_FLAG(MouseEventFlag)
|
||||
QT_Q_ENUM(ChecksumType)
|
||||
QT_Q_ENUM(HighDpiScaleFactorRoundingPolicy)
|
||||
QT_Q_ENUM(TabFocusBehavior)
|
||||
Q_ENUM_NS(CursorMoveStyle)
|
||||
Q_ENUM_NS(TimerType)
|
||||
Q_ENUM_NS(ScrollPhase)
|
||||
Q_ENUM_NS(MouseEventSource)
|
||||
Q_FLAG_NS(MouseEventFlag)
|
||||
Q_ENUM_NS(ChecksumType)
|
||||
Q_ENUM_NS(HighDpiScaleFactorRoundingPolicy)
|
||||
Q_ENUM_NS(TabFocusBehavior)
|
||||
#endif // Q_DOC
|
||||
|
||||
}
|
||||
#ifdef Q_MOC_RUN
|
||||
;
|
||||
#endif
|
||||
|
||||
#undef QT_Q_ENUM
|
||||
#undef QT_Q_FLAG
|
||||
|
||||
typedef bool (*qInternalCallback)(void **);
|
||||
|
||||
|
|
|
|||
|
|
@ -1163,7 +1163,7 @@ QMetaProperty QMetaObject::property(int index) const
|
|||
|
||||
const QMetaObject *scope = 0;
|
||||
if (qstrcmp(scope_name, "Qt") == 0)
|
||||
scope = &QObject::staticQtMetaObject;
|
||||
scope = &Qt::staticMetaObject;
|
||||
else
|
||||
scope = QMetaObject_findMetaObject(this, scope_name);
|
||||
if (scope)
|
||||
|
|
|
|||
|
|
@ -434,9 +434,6 @@ protected:
|
|||
protected:
|
||||
QScopedPointer<QObjectData> d_ptr;
|
||||
|
||||
static const QMetaObject staticQtMetaObject;
|
||||
friend inline const QMetaObject *qt_getQtMetaObject() noexcept;
|
||||
|
||||
friend struct QMetaObject;
|
||||
friend struct QMetaObjectPrivate;
|
||||
friend class QMetaCallEvent;
|
||||
|
|
@ -467,9 +464,6 @@ inline QMetaObject::Connection QObject::connect(const QObject *asender, const ch
|
|||
const char *amember, Qt::ConnectionType atype) const
|
||||
{ return connect(asender, asignal, this, amember, atype); }
|
||||
|
||||
inline const QMetaObject *qt_getQtMetaObject() noexcept
|
||||
{ return &QObject::staticQtMetaObject; }
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 0)
|
||||
template<typename T>
|
||||
inline QT_DEPRECATED T qFindChild(const QObject *o, const QString &name = QString())
|
||||
|
|
|
|||
|
|
@ -46,199 +46,16 @@
|
|||
#endif
|
||||
|
||||
#include <QtCore/qnamespace.h>
|
||||
|
||||
#include <QtCore/qobjectdefs_impl.h>
|
||||
#include <QtCore/qtmetamacros.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QByteArray;
|
||||
struct QArrayData;
|
||||
typedef QArrayData QByteArrayData;
|
||||
|
||||
class QString;
|
||||
#ifndef Q_MOC_OUTPUT_REVISION
|
||||
#define Q_MOC_OUTPUT_REVISION 67
|
||||
#endif
|
||||
|
||||
// The following macros can be defined by tools that understand Qt
|
||||
// to have the information from the macro.
|
||||
#ifndef QT_ANNOTATE_CLASS
|
||||
# define QT_ANNOTATE_CLASS(type, ...)
|
||||
#endif
|
||||
#ifndef QT_ANNOTATE_CLASS2
|
||||
# define QT_ANNOTATE_CLASS2(type, a1, a2)
|
||||
#endif
|
||||
#ifndef QT_ANNOTATE_FUNCTION
|
||||
# define QT_ANNOTATE_FUNCTION(x)
|
||||
#endif
|
||||
#ifndef QT_ANNOTATE_ACCESS_SPECIFIER
|
||||
# define QT_ANNOTATE_ACCESS_SPECIFIER(x)
|
||||
#endif
|
||||
|
||||
// The following macros are our "extensions" to C++
|
||||
// They are used, strictly speaking, only by the moc.
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
#ifndef QT_NO_META_MACROS
|
||||
# if defined(QT_NO_KEYWORDS)
|
||||
# define QT_NO_EMIT
|
||||
# else
|
||||
# ifndef QT_NO_SIGNALS_SLOTS_KEYWORDS
|
||||
# define slots Q_SLOTS
|
||||
# define signals Q_SIGNALS
|
||||
# endif
|
||||
# endif
|
||||
# define Q_SLOTS QT_ANNOTATE_ACCESS_SPECIFIER(qt_slot)
|
||||
# define Q_SIGNALS public QT_ANNOTATE_ACCESS_SPECIFIER(qt_signal)
|
||||
# define Q_PRIVATE_SLOT(d, signature) QT_ANNOTATE_CLASS2(qt_private_slot, d, signature)
|
||||
# define Q_EMIT
|
||||
#ifndef QT_NO_EMIT
|
||||
# define emit
|
||||
#endif
|
||||
#ifndef Q_CLASSINFO
|
||||
# define Q_CLASSINFO(name, value)
|
||||
#endif
|
||||
#define Q_PLUGIN_METADATA(x) QT_ANNOTATE_CLASS(qt_plugin_metadata, x)
|
||||
#define Q_INTERFACES(x) QT_ANNOTATE_CLASS(qt_interfaces, x)
|
||||
#define Q_PROPERTY(...) QT_ANNOTATE_CLASS(qt_property, __VA_ARGS__)
|
||||
#define Q_PRIVATE_PROPERTY(d, text) QT_ANNOTATE_CLASS2(qt_private_property, d, text)
|
||||
#ifndef Q_REVISION
|
||||
# define Q_REVISION(v)
|
||||
#endif
|
||||
#define Q_OVERRIDE(text) QT_ANNOTATE_CLASS(qt_override, text)
|
||||
#define QDOC_PROPERTY(text) QT_ANNOTATE_CLASS(qt_qdoc_property, text)
|
||||
#define Q_ENUMS(x) QT_ANNOTATE_CLASS(qt_enums, x)
|
||||
#define Q_FLAGS(x) QT_ANNOTATE_CLASS(qt_enums, x)
|
||||
#define Q_ENUM_IMPL(ENUM) \
|
||||
friend Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
|
||||
friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
|
||||
#define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x)
|
||||
#define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x)
|
||||
#define Q_ENUM_NS_IMPL(ENUM) \
|
||||
inline Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
|
||||
inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
|
||||
#define Q_ENUM_NS(x) Q_ENUMS(x) Q_ENUM_NS_IMPL(x)
|
||||
#define Q_FLAG_NS(x) Q_FLAGS(x) Q_ENUM_NS_IMPL(x)
|
||||
#define Q_SCRIPTABLE QT_ANNOTATE_FUNCTION(qt_scriptable)
|
||||
#define Q_INVOKABLE QT_ANNOTATE_FUNCTION(qt_invokable)
|
||||
#define Q_SIGNAL QT_ANNOTATE_FUNCTION(qt_signal)
|
||||
#define Q_SLOT QT_ANNOTATE_FUNCTION(qt_slot)
|
||||
#endif // QT_NO_META_MACROS
|
||||
|
||||
#ifndef QT_NO_TRANSLATION
|
||||
// full set of tr functions
|
||||
# define QT_TR_FUNCTIONS \
|
||||
static inline QString tr(const char *s, const char *c = nullptr, int n = -1) \
|
||||
{ return staticMetaObject.tr(s, c, n); } \
|
||||
QT_DEPRECATED static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) \
|
||||
{ return staticMetaObject.tr(s, c, n); }
|
||||
#else
|
||||
// inherit the ones from QObject
|
||||
# define QT_TR_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#ifdef Q_CLANG_QDOC
|
||||
#define QT_TR_FUNCTIONS
|
||||
#endif
|
||||
|
||||
// ### Qt6: remove
|
||||
#define Q_OBJECT_CHECK /* empty, unused since Qt 5.2 */
|
||||
|
||||
#if defined(Q_CC_INTEL)
|
||||
// Cannot redefine the visibility of a method in an exported class
|
||||
# define Q_DECL_HIDDEN_STATIC_METACALL
|
||||
#else
|
||||
# define Q_DECL_HIDDEN_STATIC_METACALL Q_DECL_HIDDEN
|
||||
#endif
|
||||
|
||||
#if defined(Q_CC_CLANG) && Q_CC_CLANG >= 306
|
||||
# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_CLANG("-Winconsistent-missing-override")
|
||||
#elif defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && Q_CC_GNU >= 501
|
||||
# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_GCC("-Wsuggest-override")
|
||||
#else
|
||||
# define Q_OBJECT_NO_OVERRIDE_WARNING
|
||||
#endif
|
||||
|
||||
#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && Q_CC_GNU >= 600
|
||||
# define Q_OBJECT_NO_ATTRIBUTES_WARNING QT_WARNING_DISABLE_GCC("-Wattributes")
|
||||
#else
|
||||
# define Q_OBJECT_NO_ATTRIBUTES_WARNING
|
||||
#endif
|
||||
|
||||
/* qmake ignore Q_OBJECT */
|
||||
#define Q_OBJECT \
|
||||
public: \
|
||||
QT_WARNING_PUSH \
|
||||
Q_OBJECT_NO_OVERRIDE_WARNING \
|
||||
static const QMetaObject staticMetaObject; \
|
||||
virtual const QMetaObject *metaObject() const; \
|
||||
virtual void *qt_metacast(const char *); \
|
||||
virtual int qt_metacall(QMetaObject::Call, int, void **); \
|
||||
QT_TR_FUNCTIONS \
|
||||
private: \
|
||||
Q_OBJECT_NO_ATTRIBUTES_WARNING \
|
||||
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
|
||||
QT_WARNING_POP \
|
||||
struct QPrivateSignal {}; \
|
||||
QT_ANNOTATE_CLASS(qt_qobject, "")
|
||||
|
||||
/* qmake ignore Q_OBJECT */
|
||||
#define Q_OBJECT_FAKE Q_OBJECT QT_ANNOTATE_CLASS(qt_fake, "")
|
||||
|
||||
#ifndef QT_NO_META_MACROS
|
||||
/* qmake ignore Q_GADGET */
|
||||
#define Q_GADGET \
|
||||
public: \
|
||||
static const QMetaObject staticMetaObject; \
|
||||
void qt_check_for_QGADGET_macro(); \
|
||||
typedef void QtGadgetHelper; \
|
||||
private: \
|
||||
QT_WARNING_PUSH \
|
||||
Q_OBJECT_NO_ATTRIBUTES_WARNING \
|
||||
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
|
||||
QT_WARNING_POP \
|
||||
QT_ANNOTATE_CLASS(qt_qgadget, "") \
|
||||
/*end*/
|
||||
|
||||
/* qmake ignore Q_NAMESPACE_EXPORT */
|
||||
#define Q_NAMESPACE_EXPORT(...) \
|
||||
extern __VA_ARGS__ const QMetaObject staticMetaObject; \
|
||||
QT_ANNOTATE_CLASS(qt_qnamespace, "") \
|
||||
/*end*/
|
||||
|
||||
/* qmake ignore Q_NAMESPACE */
|
||||
#define Q_NAMESPACE Q_NAMESPACE_EXPORT() \
|
||||
/*end*/
|
||||
|
||||
#endif // QT_NO_META_MACROS
|
||||
|
||||
#else // Q_MOC_RUN
|
||||
#define slots slots
|
||||
#define signals signals
|
||||
#define Q_SLOTS Q_SLOTS
|
||||
#define Q_SIGNALS Q_SIGNALS
|
||||
#define Q_CLASSINFO(name, value) Q_CLASSINFO(name, value)
|
||||
#define Q_INTERFACES(x) Q_INTERFACES(x)
|
||||
#define Q_PROPERTY(text) Q_PROPERTY(text)
|
||||
#define Q_PRIVATE_PROPERTY(d, text) Q_PRIVATE_PROPERTY(d, text)
|
||||
#define Q_REVISION(v) Q_REVISION(v)
|
||||
#define Q_OVERRIDE(text) Q_OVERRIDE(text)
|
||||
#define Q_ENUMS(x) Q_ENUMS(x)
|
||||
#define Q_FLAGS(x) Q_FLAGS(x)
|
||||
#define Q_ENUM(x) Q_ENUM(x)
|
||||
#define Q_FLAGS(x) Q_FLAGS(x)
|
||||
/* qmake ignore Q_OBJECT */
|
||||
#define Q_OBJECT Q_OBJECT
|
||||
/* qmake ignore Q_OBJECT */
|
||||
#define Q_OBJECT_FAKE Q_OBJECT_FAKE
|
||||
/* qmake ignore Q_GADGET */
|
||||
#define Q_GADGET Q_GADGET
|
||||
#define Q_SCRIPTABLE Q_SCRIPTABLE
|
||||
#define Q_INVOKABLE Q_INVOKABLE
|
||||
#define Q_SIGNAL Q_SIGNAL
|
||||
#define Q_SLOT Q_SLOT
|
||||
#endif //Q_MOC_RUN
|
||||
|
||||
#ifndef QT_NO_META_MACROS
|
||||
// macro for onaming members
|
||||
|
|
|
|||
|
|
@ -0,0 +1,233 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Copyright (C) 2019 Olivier Goffart <ogoffart@woboq.com>
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QTMETAMACROS_H
|
||||
#define QTMETAMACROS_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef Q_MOC_OUTPUT_REVISION
|
||||
#define Q_MOC_OUTPUT_REVISION 67
|
||||
#endif
|
||||
|
||||
// The following macros can be defined by tools that understand Qt
|
||||
// to have the information from the macro.
|
||||
#ifndef QT_ANNOTATE_CLASS
|
||||
# define QT_ANNOTATE_CLASS(type, ...)
|
||||
#endif
|
||||
#ifndef QT_ANNOTATE_CLASS2
|
||||
# define QT_ANNOTATE_CLASS2(type, a1, a2)
|
||||
#endif
|
||||
#ifndef QT_ANNOTATE_FUNCTION
|
||||
# define QT_ANNOTATE_FUNCTION(x)
|
||||
#endif
|
||||
#ifndef QT_ANNOTATE_ACCESS_SPECIFIER
|
||||
# define QT_ANNOTATE_ACCESS_SPECIFIER(x)
|
||||
#endif
|
||||
|
||||
// The following macros are our "extensions" to C++
|
||||
// They are used, strictly speaking, only by the moc.
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
#ifndef QT_NO_META_MACROS
|
||||
# if defined(QT_NO_KEYWORDS)
|
||||
# define QT_NO_EMIT
|
||||
# else
|
||||
# ifndef QT_NO_SIGNALS_SLOTS_KEYWORDS
|
||||
# define slots Q_SLOTS
|
||||
# define signals Q_SIGNALS
|
||||
# endif
|
||||
# endif
|
||||
# define Q_SLOTS QT_ANNOTATE_ACCESS_SPECIFIER(qt_slot)
|
||||
# define Q_SIGNALS public QT_ANNOTATE_ACCESS_SPECIFIER(qt_signal)
|
||||
# define Q_PRIVATE_SLOT(d, signature) QT_ANNOTATE_CLASS2(qt_private_slot, d, signature)
|
||||
# define Q_EMIT
|
||||
#ifndef QT_NO_EMIT
|
||||
# define emit
|
||||
#endif
|
||||
#ifndef Q_CLASSINFO
|
||||
# define Q_CLASSINFO(name, value)
|
||||
#endif
|
||||
#define Q_PLUGIN_METADATA(x) QT_ANNOTATE_CLASS(qt_plugin_metadata, x)
|
||||
#define Q_INTERFACES(x) QT_ANNOTATE_CLASS(qt_interfaces, x)
|
||||
#define Q_PROPERTY(...) QT_ANNOTATE_CLASS(qt_property, __VA_ARGS__)
|
||||
#define Q_PRIVATE_PROPERTY(d, text) QT_ANNOTATE_CLASS2(qt_private_property, d, text)
|
||||
#ifndef Q_REVISION
|
||||
# define Q_REVISION(v)
|
||||
#endif
|
||||
#define Q_OVERRIDE(text) QT_ANNOTATE_CLASS(qt_override, text)
|
||||
#define QDOC_PROPERTY(text) QT_ANNOTATE_CLASS(qt_qdoc_property, text)
|
||||
#define Q_ENUMS(x) QT_ANNOTATE_CLASS(qt_enums, x)
|
||||
#define Q_FLAGS(x) QT_ANNOTATE_CLASS(qt_enums, x)
|
||||
#define Q_ENUM_IMPL(ENUM) \
|
||||
friend Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
|
||||
friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
|
||||
#define Q_ENUM(x) Q_ENUMS(x) Q_ENUM_IMPL(x)
|
||||
#define Q_FLAG(x) Q_FLAGS(x) Q_ENUM_IMPL(x)
|
||||
#define Q_ENUM_NS_IMPL(ENUM) \
|
||||
inline Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) noexcept { return &staticMetaObject; } \
|
||||
inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) noexcept { return #ENUM; }
|
||||
#define Q_ENUM_NS(x) Q_ENUMS(x) Q_ENUM_NS_IMPL(x)
|
||||
#define Q_FLAG_NS(x) Q_FLAGS(x) Q_ENUM_NS_IMPL(x)
|
||||
#define Q_SCRIPTABLE QT_ANNOTATE_FUNCTION(qt_scriptable)
|
||||
#define Q_INVOKABLE QT_ANNOTATE_FUNCTION(qt_invokable)
|
||||
#define Q_SIGNAL QT_ANNOTATE_FUNCTION(qt_signal)
|
||||
#define Q_SLOT QT_ANNOTATE_FUNCTION(qt_slot)
|
||||
#endif // QT_NO_META_MACROS
|
||||
|
||||
#ifndef QT_NO_TRANSLATION
|
||||
// full set of tr functions
|
||||
# define QT_TR_FUNCTIONS \
|
||||
static inline QString tr(const char *s, const char *c = nullptr, int n = -1) \
|
||||
{ return staticMetaObject.tr(s, c, n); } \
|
||||
QT_DEPRECATED static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) \
|
||||
{ return staticMetaObject.tr(s, c, n); }
|
||||
#else
|
||||
// inherit the ones from QObject
|
||||
# define QT_TR_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#ifdef Q_CLANG_QDOC
|
||||
#define QT_TR_FUNCTIONS
|
||||
#endif
|
||||
|
||||
// ### Qt6: remove
|
||||
#define Q_OBJECT_CHECK /* empty, unused since Qt 5.2 */
|
||||
|
||||
#if defined(Q_CC_INTEL)
|
||||
// Cannot redefine the visibility of a method in an exported class
|
||||
# define Q_DECL_HIDDEN_STATIC_METACALL
|
||||
#else
|
||||
# define Q_DECL_HIDDEN_STATIC_METACALL Q_DECL_HIDDEN
|
||||
#endif
|
||||
|
||||
#if defined(Q_CC_CLANG) && Q_CC_CLANG >= 306
|
||||
# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_CLANG("-Winconsistent-missing-override")
|
||||
#elif defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && Q_CC_GNU >= 501
|
||||
# define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_GCC("-Wsuggest-override")
|
||||
#else
|
||||
# define Q_OBJECT_NO_OVERRIDE_WARNING
|
||||
#endif
|
||||
|
||||
#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && Q_CC_GNU >= 600
|
||||
# define Q_OBJECT_NO_ATTRIBUTES_WARNING QT_WARNING_DISABLE_GCC("-Wattributes")
|
||||
#else
|
||||
# define Q_OBJECT_NO_ATTRIBUTES_WARNING
|
||||
#endif
|
||||
|
||||
/* qmake ignore Q_OBJECT */
|
||||
#define Q_OBJECT \
|
||||
public: \
|
||||
QT_WARNING_PUSH \
|
||||
Q_OBJECT_NO_OVERRIDE_WARNING \
|
||||
static const QMetaObject staticMetaObject; \
|
||||
virtual const QMetaObject *metaObject() const; \
|
||||
virtual void *qt_metacast(const char *); \
|
||||
virtual int qt_metacall(QMetaObject::Call, int, void **); \
|
||||
QT_TR_FUNCTIONS \
|
||||
private: \
|
||||
Q_OBJECT_NO_ATTRIBUTES_WARNING \
|
||||
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
|
||||
QT_WARNING_POP \
|
||||
struct QPrivateSignal {}; \
|
||||
QT_ANNOTATE_CLASS(qt_qobject, "")
|
||||
|
||||
/* qmake ignore Q_OBJECT */
|
||||
#define Q_OBJECT_FAKE Q_OBJECT QT_ANNOTATE_CLASS(qt_fake, "")
|
||||
|
||||
#ifndef QT_NO_META_MACROS
|
||||
/* qmake ignore Q_GADGET */
|
||||
#define Q_GADGET \
|
||||
public: \
|
||||
static const QMetaObject staticMetaObject; \
|
||||
void qt_check_for_QGADGET_macro(); \
|
||||
typedef void QtGadgetHelper; \
|
||||
private: \
|
||||
QT_WARNING_PUSH \
|
||||
Q_OBJECT_NO_ATTRIBUTES_WARNING \
|
||||
Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \
|
||||
QT_WARNING_POP \
|
||||
QT_ANNOTATE_CLASS(qt_qgadget, "") \
|
||||
/*end*/
|
||||
|
||||
/* qmake ignore Q_NAMESPACE_EXPORT */
|
||||
#define Q_NAMESPACE_EXPORT(...) \
|
||||
extern __VA_ARGS__ const QMetaObject staticMetaObject; \
|
||||
QT_ANNOTATE_CLASS(qt_qnamespace, "") \
|
||||
/*end*/
|
||||
|
||||
/* qmake ignore Q_NAMESPACE */
|
||||
#define Q_NAMESPACE Q_NAMESPACE_EXPORT() \
|
||||
/*end*/
|
||||
|
||||
#endif // QT_NO_META_MACROS
|
||||
|
||||
#else // Q_MOC_RUN
|
||||
#define slots slots
|
||||
#define signals signals
|
||||
#define Q_SLOTS Q_SLOTS
|
||||
#define Q_SIGNALS Q_SIGNALS
|
||||
#define Q_CLASSINFO(name, value) Q_CLASSINFO(name, value)
|
||||
#define Q_INTERFACES(x) Q_INTERFACES(x)
|
||||
#define Q_PROPERTY(text) Q_PROPERTY(text)
|
||||
#define Q_PRIVATE_PROPERTY(d, text) Q_PRIVATE_PROPERTY(d, text)
|
||||
#define Q_REVISION(v) Q_REVISION(v)
|
||||
#define Q_OVERRIDE(text) Q_OVERRIDE(text)
|
||||
#define Q_ENUMS(x) Q_ENUMS(x)
|
||||
#define Q_FLAGS(x) Q_FLAGS(x)
|
||||
#define Q_ENUM(x) Q_ENUM(x)
|
||||
#define Q_FLAGS(x) Q_FLAGS(x)
|
||||
/* qmake ignore Q_OBJECT */
|
||||
#define Q_OBJECT Q_OBJECT
|
||||
/* qmake ignore Q_OBJECT */
|
||||
#define Q_OBJECT_FAKE Q_OBJECT_FAKE
|
||||
/* qmake ignore Q_GADGET */
|
||||
#define Q_GADGET Q_GADGET
|
||||
#define Q_SCRIPTABLE Q_SCRIPTABLE
|
||||
#define Q_INVOKABLE Q_INVOKABLE
|
||||
#define Q_SIGNAL Q_SIGNAL
|
||||
#define Q_SLOT Q_SLOT
|
||||
#endif //Q_MOC_RUN
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QTMETAMACROS_H
|
||||
|
|
@ -194,7 +194,6 @@ static bool qualifiedNameEquals(const QByteArray &qualifiedName, const QByteArra
|
|||
|
||||
void Generator::generateCode()
|
||||
{
|
||||
bool isQt = (cdef->classname == "Qt");
|
||||
bool isQObject = (cdef->classname == "QObject");
|
||||
bool isConstructible = !cdef->constructorList.isEmpty();
|
||||
|
||||
|
|
@ -452,7 +451,7 @@ void Generator::generateCode()
|
|||
//
|
||||
// Generate internal qt_static_metacall() function
|
||||
//
|
||||
const bool hasStaticMetaCall = !isQt &&
|
||||
const bool hasStaticMetaCall =
|
||||
(cdef->hasQObject || !cdef->methodList.isEmpty()
|
||||
|| !cdef->propertyList.isEmpty() || !cdef->constructorList.isEmpty());
|
||||
if (hasStaticMetaCall)
|
||||
|
|
@ -534,10 +533,7 @@ void Generator::generateCode()
|
|||
//
|
||||
// Finally create and initialize the static meta object
|
||||
//
|
||||
if (isQt)
|
||||
fprintf(out, "QT_INIT_METAOBJECT const QMetaObject QObject::staticQtMetaObject = { {\n");
|
||||
else
|
||||
fprintf(out, "QT_INIT_METAOBJECT const QMetaObject %s::staticMetaObject = { {\n", cdef->qualified.constData());
|
||||
fprintf(out, "QT_INIT_METAOBJECT const QMetaObject %s::staticMetaObject = { {\n", cdef->qualified.constData());
|
||||
|
||||
if (isQObject)
|
||||
fprintf(out, " nullptr,\n");
|
||||
|
|
@ -559,9 +555,6 @@ void Generator::generateCode()
|
|||
fprintf(out, " qt_meta_extradata_%s,\n", qualifiedClassNameIdentifier.constData());
|
||||
fprintf(out, " nullptr\n} };\n\n");
|
||||
|
||||
if(isQt)
|
||||
return;
|
||||
|
||||
if (!cdef->hasQObject)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -2008,7 +2008,7 @@ void tst_QMetaType::metaObject_data()
|
|||
QTest::newRow("MyGadget") << ::qMetaTypeId<MyGadget>() << &MyGadget::staticMetaObject << true << false << false;
|
||||
QTest::newRow("MyGadget*") << ::qMetaTypeId<MyGadget*>() << &MyGadget::staticMetaObject << false << true << false;
|
||||
QTest::newRow("MyEnum") << ::qMetaTypeId<MyGadget::MyEnum>() << &MyGadget::staticMetaObject << false << false << false;
|
||||
QTest::newRow("Qt::ScrollBarPolicy") << ::qMetaTypeId<Qt::ScrollBarPolicy>() << &QObject::staticQtMetaObject << false << false << false;
|
||||
QTest::newRow("Qt::ScrollBarPolicy") << ::qMetaTypeId<Qt::ScrollBarPolicy>() << &Qt::staticMetaObject << false << false << false;
|
||||
QTest::newRow("MyQObjectFromGadget*") << ::qMetaTypeId<MyQObjectFromGadget*>() << &MyQObjectFromGadget::staticMetaObject << false << false << true;
|
||||
|
||||
QTest::newRow("GadgetDerivedAndTyped<int>") << ::qMetaTypeId<GadgetDerivedAndTyped<int>>() << &GadgetDerivedAndTyped<int>::staticMetaObject << true << false << false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue