summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qobject.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index c96fb446d6..617fadc1ab 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3219,6 +3219,9 @@ bool QMetaObjectPrivate::disconnect(const QObject *sender,
\snippet code/src_corelib_kernel_qobject.cpp 34
+ If \a object itself has a properly set object name, its own signals are also
+ connected to its respective slots.
+
\sa QObject::setObjectName()
*/
void QMetaObject::connectSlotsByName(QObject *o)
@@ -3227,7 +3230,10 @@ void QMetaObject::connectSlotsByName(QObject *o)
return;
const QMetaObject *mo = o->metaObject();
Q_ASSERT(mo);
- const QObjectList list = o->findChildren<QObject *>(QString());
+ const QObjectList list = // list of all objects to look for matching signals including...
+ o->findChildren<QObject *>(QString()) // all children of 'o'...
+ << o; // and the object 'o' itself
+
for (int i = 0; i < mo->methodCount(); ++i) {
QByteArray slotSignature = mo->method(i).methodSignature();
const char *slot = slotSignature.constData();