diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-04-20 20:19:12 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-01 01:18:03 +0200 |
commit | 243ea09e4cc0908e28be44e3e6786ff8b73f74be (patch) | |
tree | 682dca749a478a3522e2313ea63564692f68ce1b /src/corelib/kernel/qmetaobject_p.h | |
parent | 67245d1708696627a33afa0abc9f3c2b178b8d95 (diff) |
Add QMetaMethod-based QObject::connect/disconnectNotify() API
This API will fully replace the const char *-based connectNotify()
and disconnectNotify() in Qt5; the old functions will be REMOVED
before Qt 5.0 final.
The new implementation fixes the long-standing issue of
connectNotify() not being called when using the (internal)
index-based QMetaObject::connect() (e.g., from QML).
As with the old API, there are still two "unintuitive" behaviors
concerning disconnectNotify():
- disconnectNotify() is not called when the signal is disconnected
using the QObject::disconnect(QMetaObject::Connection) overload.
- disconnectNotify() is not called when a receiver is destroyed
(i.e., when a connection is implicitly removed).
The old versions of connectNotify() and disconnectNotify() are kept
for now, and they are still called. They will be removed once known
existing reimplementations (e.g., QtNetwork, QtDBus) have been
ported to the new API.
Change-Id: I8b4f007f3c6d89199c1ba04a3e23c8ca314e0896
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'src/corelib/kernel/qmetaobject_p.h')
-rw-r--r-- | src/corelib/kernel/qmetaobject_p.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index 3b732b4b93..e78a92085c 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -198,6 +198,7 @@ struct QMetaObjectPrivate int argc, const QArgumentType *types); static int indexOfConstructor(const QMetaObject *m, const QByteArray &name, int argc, const QArgumentType *types); + static QMetaMethod signal(const QMetaObject *m, int signal_index); static bool checkConnectArgs(int signalArgc, const QArgumentType *signalTypes, int methodArgc, const QArgumentType *methodTypes); static bool checkConnectArgs(const QMetaMethodPrivate *signal, @@ -211,10 +212,12 @@ struct QMetaObjectPrivate static void memberIndexes(const QObject *obj, const QMetaMethod &member, int *signalIndex, int *methodIndex); static QObjectPrivate::Connection *connect(const QObject *sender, int signal_index, + const QMetaObject *smeta, const QObject *receiver, int method_index_relative, const QMetaObject *rmeta = 0, int type = 0, int *types = 0); static bool disconnect(const QObject *sender, int signal_index, + const QMetaObject *smeta, const QObject *receiver, int method_index, void **slot, DisconnectType = DisconnectAll); static inline bool disconnectHelper(QObjectPrivate::Connection *c, |