summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Kosmale <[email protected]>2025-06-16 10:26:55 +0200
committerQt Cherry-pick Bot <[email protected]>2025-06-30 13:39:15 +0000
commit2a64645b70d5c93e42357755f412cc7fa88e0f4c (patch)
treeb06e18942349c7a8e3b6c922aaeef1427e7f15b8
parent9a0e4d8fdc8f2716d19fe3d7b88ef095dbe62f9f (diff)
QMetaObject::connect: Fix documentation copy-paste mistake
The whole point of the new functions is to support QMetaMethods as the signal argument, but the documentation still talked about PMFs. Also mention that signal needs to be indeed a signal. Change-Id: I7d9d307f68d3f1df2fbaff0dfe2a5a80d4b7c2be Reviewed-by: Marc Mutz <[email protected]> (cherry picked from commit c3ef55ccd3db56ab9b4023c1b423ed46855824df) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
-rw-r--r--src/corelib/kernel/qobject.cpp10
-rw-r--r--src/corelib/kernel/qobjectdefs.h6
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