Use variadic templates to mark function pointers as non-QObjects.
Change-Id: I4d4e7a0498ff8f5b834dae4008d1311838180036 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>bb10
parent
affdd9d00c
commit
106dc410e9
|
|
@ -563,11 +563,16 @@ namespace QtPrivate {
|
|||
{ return -1; }
|
||||
};
|
||||
|
||||
#ifndef Q_COMPILER_VARIADIC_TEMPLATES
|
||||
// Function pointers don't derive from QObject
|
||||
template <class Result> struct IsPointerToTypeDerivedFromQObject<Result(*)()> { enum { Value = false }; };
|
||||
template <class Result, class Arg0> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0)> { enum { Value = false }; };
|
||||
template <class Result, class Arg0, class Arg1> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0, Arg1)> { enum { Value = false }; };
|
||||
template <class Result, class Arg0, class Arg1, class Arg2> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0, Arg1, Arg2)> { enum { Value = false }; };
|
||||
#else
|
||||
template <typename Result, typename... Args>
|
||||
struct IsPointerToTypeDerivedFromQObject<Result(*)(Args...)> { enum { Value = false }; };
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
struct QMetaTypeTypeFlags
|
||||
|
|
|
|||
|
|
@ -1825,11 +1825,15 @@ typedef Undefined (*UndefinedFunction0)();
|
|||
typedef Undefined (*UndefinedFunction1)(Undefined);
|
||||
typedef Undefined (*UndefinedFunction2)(Undefined, Undefined);
|
||||
typedef Undefined (*UndefinedFunction3)(Undefined, Undefined, Undefined);
|
||||
typedef Undefined (*UndefinedFunction4)(Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined, Undefined);
|
||||
|
||||
Q_DECLARE_METATYPE(UndefinedFunction0);
|
||||
Q_DECLARE_METATYPE(UndefinedFunction1);
|
||||
Q_DECLARE_METATYPE(UndefinedFunction2);
|
||||
Q_DECLARE_METATYPE(UndefinedFunction3);
|
||||
#ifdef Q_COMPILER_VARIADIC_TEMPLATES
|
||||
Q_DECLARE_METATYPE(UndefinedFunction4);
|
||||
#endif
|
||||
|
||||
QTEST_MAIN(tst_QMetaType)
|
||||
#include "tst_qmetatype.moc"
|
||||
|
|
|
|||
Loading…
Reference in New Issue