diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 5cdbef443b..f577c6d4b8 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -147,34 +147,8 @@ class QString; # define QT_TR_FUNCTIONS #endif -#if defined(QT_NO_QOBJECT_CHECK) -/* qmake ignore Q_OBJECT */ -#define Q_OBJECT_CHECK -#else - -/* This is a compile time check that ensures that any class cast with qobject_cast - actually contains a Q_OBJECT macro. Note: qobject_cast will fail if a QObject - subclass doesn't contain Q_OBJECT. - - In qt_check_for_QOBJECT_macro, we call a dummy templated function with two - parameters, the first being "this" and the other the target of the qobject - cast. If the types are not identical, we know that a Q_OBJECT macro is missing. - - If you get a compiler error here, make sure that the class you are casting - to contains a Q_OBJECT macro. -*/ - -/* qmake ignore Q_OBJECT */ -#define Q_OBJECT_CHECK \ - template inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const \ - { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } - -template -inline int qYouForgotTheQ_OBJECT_Macro(T, T) { return 0; } - -template -inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} -#endif // QT_NO_QOBJECT_CHECK +// ### 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 @@ -200,7 +174,6 @@ inline void qYouForgotTheQ_OBJECT_Macro(T1, T2) {} /* qmake ignore Q_OBJECT */ #define Q_OBJECT \ public: \ - Q_OBJECT_CHECK \ QT_WARNING_PUSH \ Q_OBJECT_NO_OVERRIDE_WARNING \ static const QMetaObject staticMetaObject; \