diff options
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 10 | ||||
-rw-r--r-- | src/corelib/kernel/qobjectdefs.h | 6 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 46f2ad7d1c4..38ded8117c0 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3912,7 +3912,7 @@ void QMetaObject::connectSlotsByName(QObject *o) /*! \fn template<typename PointerToMemberFunction> QMetaObject::Connection QMetaObject::connect( - const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) + const QObject *sender, const QMetaMethod &signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) \threadsafe \overload connect() @@ -3937,13 +3937,15 @@ void QMetaObject::connectSlotsByName(QObject *o) conversions and type checking are not handled by this function. Overloaded slots need to be explicitly be resolved with help of \l qOverload. + \a signal needs to be the meta-method of a signal, otherwise an + invalid connection will be returned. \sa QObject::connect(), QObject::disconnect() */ /*! - \fn template<typename PointerToMemberFunction, typename Functor> QMetaObject::Connection QMetaObject::connect( - const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) + \fn template<typename Functor> QMetaObject::Connection QMetaObject::connect( + const QObject *sender, const QMetaMethod &signal, const QObject *context, Functor functor, Qt::ConnectionType type) \threadsafe \overload connect() @@ -3967,6 +3969,8 @@ void QMetaObject::connectSlotsByName(QObject *o) conversions and type checking are not handled by this function. Overloaded functors need to be explicitly be resolved with help of \l qOverload. + \a signal needs to be the meta-method of a signal, otherwise an + invalid connection will be returned. The connection will automatically disconnect if the sender or the context is destroyed. diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index b369d2ed8f7..79dcd82f0c5 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -294,9 +294,9 @@ struct Q_CORE_EXPORT QMetaObject #ifdef Q_QDOC template<typename PointerToMemberFunction> - static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection); - template<typename PointerToMemberFunction, typename Functor> - static QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection); + static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type = Qt::AutoConnection); + template<typename Functor> + static QMetaObject::Connection connect(const QObject *sender, const QMetaMethod &signal, const QObject *context, Functor functor, Qt::ConnectionType type = Qt::AutoConnection); #else template <typename Func> static inline Connection |