Remove HarryF's "compiler error feature" that isn't used anymore

The "qYouForgotTheQ_OBJECT_Macro" function hasn't been used in
qobject_cast since commit 7d7e8ae3fa (Qt
5.2), when Olivier made the error use Q_STATIC_ASSERT instead.

Change-Id: I15b62e0f9cec482fbb40fffd1490d7c050084369
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
bb10
Thiago Macieira 2016-12-16 12:51:38 -08:00
parent dc6b73390b
commit d908ba2765
1 changed files with 2 additions and 29 deletions

View File

@ -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 <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const \
{ int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }
template <typename T>
inline int qYouForgotTheQ_OBJECT_Macro(T, T) { return 0; }
template <typename T1, typename T2>
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; \