From ed0b262de97dd92c831127909ea4c059962b86ce Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 18 Nov 2011 10:57:04 +0100 Subject: 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 --- doc/src/snippets/code/src_corelib_kernel_qobject.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'doc/src') 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. -- cgit v1.2.3