The signal and slot mechanism is the extension of QT to C ++. This function is available only for the subclass of qobject.
Classes that support signals and slots must be derived from qobject and defined using the q_object macro.
The signal and slot mean that the caller and the called are separated to achieve high cohesion and low coupling.
Signal definition:
In the class, it is represented by the signals identifier.
The signal declaration and function declaration formats are the same, but they do not need to be implemented.
Signal has no access permission. The default value is protected.
Definition of Slot functions:
In the class, slots is used to represent the slots.
It can set access permissions.
It can be implemented in the same way as normal functions.
It can be called like a common function.
Signal and slot connections
Signal and slot can be many to many.
It can also be transmitted, that is, the signal can be connected to the signal.
The signal parameters must be more or the same than the slot.
The signal parameters must be consistent with the slot parameter types.
Both the signal and the slot support heavy load.
Signal call
Emit mysignal (); call the signal function with the reserved words of emit.
[QT] signal and slot