Qt disconnect function

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 myObjectconnection, between the signals used with other objects of the object myObjectsignal is not emitted in response function corresponding slots

disconnect(myObject, 0, 0, 0);
// or
myObject->disconnect();

2. Disconnect the myObjectobject mySignal()is connected between the signal and the other objects, the use of myObjectissue mySignal()slot function is no corresponding signal responsive

disconnect(myObject, SIGNAL(mySignal()), 0, 0);
// or
myObject->disconnect(SIGNAL(mySignal()));

3. Disconnect the myObjecttarget and myReceiverthe connection between the objects, using the myObjectsent mySignal()signal myReceiverslots corresponding to the function to respond

disconnect(myObject, 0, myReceiver, 0);
// or
myObject->disconnect(myReceiver);

note:

  1. 0It refers to any signal or a receiver object
  2. const QObject * senderIt 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.

Guess you like

Origin www.cnblogs.com/nanqiang/p/11198818.html