diff options
Diffstat (limited to 'src/corelib/kernel/qobject.h')
-rw-r--r-- | src/corelib/kernel/qobject.h | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 87d006bdc6..3cec9802dc 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -302,7 +302,6 @@ public: connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type = Qt::AutoConnection) { -#if defined (Q_COMPILER_VARIADIC_TEMPLATES) typedef QtPrivate::FunctionPointer<Func1> SignalType; const int FunctorArgumentCount = QtPrivate::ComputeFunctorArgumentCount<Func2 , typename SignalType::Arguments>::Value; @@ -310,28 +309,6 @@ public: "Signal and slot arguments are not compatible."); const int SlotArgumentCount = (FunctorArgumentCount >= 0) ? FunctorArgumentCount : 0; typedef typename QtPrivate::FunctorReturnType<Func2, typename QtPrivate::List_Left<typename SignalType::Arguments, SlotArgumentCount>::Value>::Value SlotReturnType; -#else - // Without variadic template, we don't detect the best overload of operator(). We just - // assume there is only one simple operator() and connect to &Func2::operator() - - /* If you get an error such as: - couldn't deduce template parameter 'Func2Operator' - or - cannot resolve address of overloaded function - It means the functor does not have a single operator(). - Functors with overloaded or templated operator() are only supported if the compiler supports - C++11 variadic templates - */ - typedef QtPrivate::FunctionPointer<decltype(&Func2::operator())> SlotType ; - typedef QtPrivate::FunctionPointer<Func1> SignalType; - typedef typename SlotType::ReturnType SlotReturnType; - const int SlotArgumentCount = SlotType::ArgumentCount; - - Q_STATIC_ASSERT_X(int(SignalType::ArgumentCount) >= SlotArgumentCount, - "The slot requires more arguments than the signal provides."); - Q_STATIC_ASSERT_X((QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::value), - "Signal and slot arguments are not compatible."); -#endif Q_STATIC_ASSERT_X((QtPrivate::AreArgumentsCompatible<SlotReturnType, typename SignalType::ReturnType>::value), "Return type of the slot is not compatible with the return type of the signal."); @@ -446,8 +423,7 @@ protected: QScopedPointer<QObjectData> d_ptr; static const QMetaObject staticQtMetaObject; - friend inline const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT - { return &staticQtMetaObject; } + friend inline const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT; friend struct QMetaObject; friend struct QMetaObjectPrivate; @@ -478,6 +454,9 @@ 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() Q_DECL_NOEXCEPT +{ return &QObject::staticQtMetaObject; } + #ifndef QT_NO_USERDATA class Q_CORE_EXPORT QObjectUserData { public: |