Understanding Qt signals and slots
In GUI programming, when a user performs any action with any UI element, another element should get updated, or a certain task should be done. To achieve this, we want communication between objects. For example, if a user clicks the Close button on the Title bar, it is expected that the window closes. Different frameworks use different approaches to achieve this kind of communication. A callback is one of the most commonly used approaches. A callback is a function that's passed as an argument to another function. Callbacks can have multiple drawbacks and may suffer from complications in ensuring the type-correctness of callback arguments.
In the Qt framework, we have a substitute for this callback technique known as signals and slots. A signal is a message that is passed to communicate that the state of an object has changed. This signal may carry information about the change that has occurred. A slot is a special function that is invoked...