diff options
| author | Ahmad Samir <a.samirh78@gmail.com> | 2025-08-13 14:14:13 +0300 |
|---|---|---|
| committer | Ahmad Samir <a.samirh78@gmail.com> | 2025-08-16 07:44:22 +0300 |
| commit | 6f353fc17a3a6f1786359df36db209d6c5b0fa42 (patch) | |
| tree | 16fff1ed818067140e05e30b92ebd176e773861d /src/corelib/kernel/qobject.cpp | |
| parent | 9d8ffc0685eb28198cf04c8afdfae62a449552e8 (diff) | |
QObject: clarify what `method` is in string-based (dis)connect overloads
Thanks to Fabian for the insight about Q_INVOKABLE.
Fixes: QTBUG-139128
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I6e00378288d4a50e90788a182273e0e32ada4826
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
| -rw-r--r-- | src/corelib/kernel/qobject.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index aa429636bd3..229b926bb5b 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2955,6 +2955,12 @@ static inline void check_and_warn_compat(const QMetaObject *sender, const QMetaM Returns a handle to the connection that can be used to disconnect it later. + \a signal must be a member function decleared as a signal in \a sender. + + \a method must be a member function declared as a signal, slot, or + \l{Q_INVOKABLE}{invokable} in \a receiver, that is, functions registered + with the meta-object system. + You must use the \c SIGNAL() and \c SLOT() macros when specifying the \a signal and the \a method, for example: @@ -3241,6 +3247,13 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const QMetaMetho \a receiver. Returns \c true if the connection is successfully broken; otherwise returns \c false. + \a signal, if not \nullptr, must be a member function decleared as a signal + in \a sender. + + \a method, if not \nullptr, must be a member function declared as a signal, + slot, or \l{Q_INVOKABLE}{invokable} in \a receiver, that is, functions + registered with the meta-object system. + A signal-slot connection is removed when either of the objects involved are destroyed. |
