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/qobject.h | |
| parent | 67245d1708696627a33afa0abc9f3c2b178b8d95 (diff) | |
| download | qtbase-243ea09e4cc0908e28be44e3e6786ff8b73f74be.tar.gz | |
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/qobject.h')
| -rw-r--r-- | src/corelib/kernel/qobject.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 11b1a19e0b..d840d9184f 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -370,6 +370,9 @@ protected: virtual void childEvent(QChildEvent *); virtual void customEvent(QEvent *); + virtual void connectNotify(const QMetaMethod &signal); + virtual void disconnectNotify(const QMetaMethod &signal); + // Deprecated; to be removed before Qt 5.0 virtual void connectNotify(const char *signal); virtual void disconnectNotify(const char *signal); @@ -382,6 +385,7 @@ protected: static const QMetaObject staticQtMetaObject; friend struct QMetaObject; + friend struct QMetaObjectPrivate; friend class QMetaCallEvent; friend class QApplication; friend class QApplicationPrivate; |
