summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2011-11-18 10:57:04 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-29 17:08:39 +0100
commited0b262de97dd92c831127909ea4c059962b86ce (patch)
treeb5ab25866220b0d0a136bd5b77dd227d55fcb0f8 /doc/src/snippets/code/src_corelib_kernel_qobject.cpp
parenta482487b9ff0cf0c47f9c0927c44019d52e2fdf8 (diff)
QObject::disconnect with new syntax
This add an overload to disconnect which is symetrical to the new syntax of connect. It is possible to diconnect connection like this: QObject::connect( sender, &Sender::valueChanged, receiver, &Receiver::updateValue ); QObject::disconnect( sender, &Sender::valueChanged, receiver, &Receiver::updateValue ); This overload only work with pointer to member function, and not static functions or functors. The test is copied from tst_QObject::disconnect(), just changed the syntax of the connection and disconnection Change-Id: Ia8f819100cb12098e32877522b97b732b1e676a8 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'doc/src/snippets/code/src_corelib_kernel_qobject.cpp')
-rw-r--r--doc/src/snippets/code/src_corelib_kernel_qobject.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
index 11b70cc1ab..b6d0e39ab0 100644
--- a/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
+++ b/doc/src/snippets/code/src_corelib_kernel_qobject.cpp
@@ -470,7 +470,14 @@ QObject::connect(socket, &QTcpSocket::connected, [=] () {
});
//! [46]
+//! [47]
+disconnect(myObject, &MyObject::mySignal(), 0, 0);
+//! [47]
+//! [48]
+QObject::disconnect(lineEdit, &QLineEdit::textChanged,
+ label, &QLabel::setText);
+//! [48]
//! [meta data]
//: This is a comment for the translator.