1. Introduction disconnect()
Usage
disconnect()
There are three kinds of usage prototype is as follows:
bool QObject::disconnect(const QObject * sender, const char * signal, const QObject * receiver, const char * method)
1. Disconnect the myObject
connection, between the signals used with other objects of the object myObject
signal is not emitted in response function corresponding slots
disconnect(myObject, 0, 0, 0);
// or
myObject->disconnect();
2. Disconnect the myObject
object mySignal()
is connected between the signal and the other objects, the use of myObject
issue mySignal()
slot function is no corresponding signal responsive
disconnect(myObject, SIGNAL(mySignal()), 0, 0);
// or
myObject->disconnect(SIGNAL(mySignal()));
3. Disconnect the myObject
target and myReceiver
the connection between the objects, using the myObject
sent mySignal()
signal myReceiver
slots corresponding to the function to respond
disconnect(myObject, 0, myReceiver, 0);
// or
myObject->disconnect(myReceiver);
note:
0
It refers to any signal or a receiver objectconst QObject * sender
It can not be0
Author: house arc
link: https: //www.jianshu.com/p/986851c507da
Source: Jane book
Jane book copyright reserved by the authors, are reproduced in any form, please contact the author to obtain authorization and indicate the source.