summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-04-20 20:19:12 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-01 01:18:03 +0200
commit243ea09e4cc0908e28be44e3e6786ff8b73f74be (patch)
tree682dca749a478a3522e2313ea63564692f68ce1b /src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp
parent67245d1708696627a33afa0abc9f3c2b178b8d95 (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/doc/snippets/code/src_corelib_kernel_qobject.cpp')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp
index 5b27775322..2367bfd724 100644
--- a/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp
@@ -339,8 +339,8 @@ myObject->disconnect(myReceiver);
//! [32]
-if (QLatin1String(signal) == SIGNAL(valueChanged(int))) {
- // signal is valueChanged(int)
+if (signal == QMetaMethod::fromSignal(&MyObject::valueChanged)) {
+ // signal is valueChanged
}
//! [32]