summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2011-12-15 06:57:17 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-29 12:40:51 +0100
commit889092504e0f1e67dc9c7f27817fb809d7170132 (patch)
tree0ec991259231f9c3062595d9f99bf4dd813a1e49 /src
parent7c0153faf7664bf0f7e64b578f3d196aae02c328 (diff)
Call connectNotify when connecting with function pointer
Some objects expect connectNotify to be called in order the signal to be emitted. Change-Id: Id0460d9c2aef8f9c3618a2b62b2119a790e06f30 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qobject.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index f151acd703..c51507c2e2 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -4038,7 +4038,19 @@ QMetaObject::Connection QObject::connectImpl(const QObject *sender, void **signa
}
QObjectPrivate::get(s)->addConnection(signal_index, c.data());
- return QMetaObject::Connection(c.take());
+ QMetaObject::Connection ret(c.take());
+ locker.unlock();
+
+ // reconstruct the signature to call connectNotify
+ const char *sig = senderMetaObject->d.stringdata + senderMetaObject->d.data[
+ reinterpret_cast<const QMetaObjectPrivate*>(senderMetaObject->d.data)->methodData
+ + 5 * (signal_index - signalOffset)];
+ QVarLengthArray<char> signalSignature(qstrlen(sig) + 2);
+ signalSignature.data()[0] = char(QSIGNAL_CODE + '0');
+ strcpy(signalSignature.data() + 1 , sig);
+ s->connectNotify(signalSignature.data());
+
+ return ret;
}
/*!