From 243ea09e4cc0908e28be44e3e6786ff8b73f74be Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 20 Apr 2012 20:19:12 +0200 Subject: Add QMetaMethod-based QObject::connect/disconnectNotify() API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Bradley T. Hughes Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll Reviewed-by: Jędrzej Nowacki --- src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/doc/snippets/code/src_corelib_kernel_qobject.cpp') 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] -- cgit v1.2.3