Connect is usually used. In fact, the last parameter uses the QT: autoconnection type: QT supports six connection modes, of which 3 is the most important:
1. QT: directconnection (direct connection mode) (the relationship between signals and slot functions is similar to function call and synchronous execution)
When the signal is sent, the corresponding slot function will be called immediately. The code after the emit statement is executed after all the slot functions are executed.
2. QT: queuedconnection (queuing method) (in this case, the signal is inserted into the signal queue. The relationship between the signal and the slot function is similar to message communication and is executed asynchronously)
After the signal is sent, It is queued to the signal queue. The signal is obtained only when the event loop of the thread to which the receiving object belongs obtains control, and the corresponding slot function is called. The code after the emit statement is executed immediately after the signal is sent, without waiting for the execution of the slot function to complete.
3. QT: autoconnection (automatic mode)
The default connection mode of QT. If the signal sending and receiving objects belong to the same thread, the working mode is the same as the direct connection mode; otherwise, the working mode is the same as the queuing mode.
If this parameter is not set, what is the default expression?
If this parameter is not added, the direct connection mode is the same: when the signal is sent, the corresponding slot function will be called immediately. The code after the emit statement is executed after all the slot functions are executed. In this thread, it is executed and synchronized sequentially, but it must be asynchronous with other threads. If multithreading is used, manual synchronization is still required.
Synchronization and asynchronous processing of QT signal-Slot