From c3ef55ccd3db56ab9b4023c1b423ed46855824df Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Mon, 16 Jun 2025 10:26:55 +0200 Subject: 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. Pick-to: 6.10 Change-Id: I7d9d307f68d3f1df2fbaff0dfe2a5a80d4b7c2be Reviewed-by: Marc Mutz --- src/corelib/kernel/qobject.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/corelib/kernel/qobject.cpp') 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 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 QMetaObject::Connection QMetaObject::connect( - const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) + \fn template 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. -- cgit v1.2.3