The working mechanism of Qt signals and slots
In the previous sections, we learned about signal and slot syntaxes and how to connect them. Now, we will understand how it works.
While creating a connection, Qt looks for the index of the signal and the slot. Qt uses a lookup string table to find the corresponding indexes. Then, a QObjectPrivate::Connection
object is created and added to the internal linked lists. Since one signal can be connected to multiple slots, each signal can have a list of the connected slots. Each connection contains the receiver's name and the index of the slot. Each object has a connection vector that associates with each signal in a linked list of QObjectPrivate::Connection
.
The following diagram illustrates how ConnectionList
creates connections between sender and receiver objects:
ConnectionList
is a singly linked list that contains...