Signals and slots can be connected and disconnected dynamically using the QObject::connect() and QObject::disconnect() functions. A regular, signal-slot connection is defined by the following four attributes:
- An object that changes its state (sender)
- A signal in the sender object
- An object that contains the function to be called (receiver)
- A slot in the receiver
If you want to make the connection, you need to call the QObject::connect function and pass these four parameters to it. For example, the following code can be used to clear the input box whenever the button is clicked on:
connect(button, &QPushButton::clicked, lineEdit, &QLineEdit::clear);
Signals and slots in this code are specified using a standard ...