diff options
Diffstat (limited to 'src/corelib/kernel/qobjectdefs.h')
-rw-r--r-- | src/corelib/kernel/qobjectdefs.h | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 25e43d0ca0..31e8a670e9 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -84,6 +84,10 @@ class QString; #define Q_OVERRIDE(text) #define Q_ENUMS(x) #define Q_FLAGS(x) +#define Q_ENUM(ENUM) \ + friend Q_DECL_CONSTEXPR const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return &staticMetaObject; } \ + friend Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; } +#define Q_FLAG(ENUM) Q_ENUM(ENUM) #define Q_SCRIPTABLE #define Q_INVOKABLE #define Q_SIGNAL @@ -93,9 +97,9 @@ class QString; #ifndef QT_NO_TRANSLATION // full set of tr functions # define QT_TR_FUNCTIONS \ - static inline QString tr(const char *s, const char *c = 0, int n = -1) \ + static inline QString tr(const char *s, const char *c = Q_NULLPTR, int n = -1) \ { return staticMetaObject.tr(s, c, n); } \ - QT_DEPRECATED static inline QString trUtf8(const char *s, const char *c = 0, int n = -1) \ + QT_DEPRECATED static inline QString trUtf8(const char *s, const char *c = Q_NULLPTR, int n = -1) \ { return staticMetaObject.tr(s, c, n); } #else // inherit the ones from QObject @@ -138,15 +142,24 @@ inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} # 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") +#else +# define Q_OBJECT_NO_OVERRIDE_WARNING +#endif + /* qmake ignore Q_OBJECT */ #define Q_OBJECT \ public: \ Q_OBJECT_CHECK \ + QT_WARNING_PUSH \ + Q_OBJECT_NO_OVERRIDE_WARNING \ static const QMetaObject staticMetaObject; \ virtual const QMetaObject *metaObject() const; \ virtual void *qt_metacast(const char *); \ - QT_TR_FUNCTIONS \ virtual int qt_metacall(QMetaObject::Call, int, void **); \ + QT_WARNING_POP \ + QT_TR_FUNCTIONS \ private: \ Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); \ struct QPrivateSignal {}; @@ -159,7 +172,9 @@ private: \ #define Q_GADGET \ public: \ static const QMetaObject staticMetaObject; \ -private: + typedef void QtGadgetHelper; \ +private: \ + Q_DECL_HIDDEN_STATIC_METACALL static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); #endif // QT_NO_META_MACROS #else // Q_MOC_RUN @@ -175,6 +190,8 @@ private: #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 */ |