PDA

View Full Version : signal/slot mechanism is totally independent of any GUI event loop



twosnowman
23rd January 2006, 03:15
In Qt Documents about Signal/Slot, It says that "The signal/slot mechanism is totally independent of any GUI event loop" . How to comprehend this words? On my opinion, for example, if a user clicked a PushButton, the event loop will catch this event and a Clicked() signal will be sent ? If the connected slot will not return, the GUI will be blocked. So I am mazed about this words.

jacek
23rd January 2006, 04:15
In Qt Documents about Signal/Slot, It says that "The signal/slot mechanism is totally independent of any GUI event loop" .
It means that this mechanism will work even if you don't have a running event loop.


If the connected slot will not return, the GUI will be blocked.
If you have only one thread, you can't execute different parts of your code simultaneously.

wysota
23rd January 2006, 12:16
And not every signal is emited from an event handler.

Codepoet
23rd January 2006, 16:38
It means that this mechanism will work even if you don't have a running event loop.
At least if you have multiple threads with queued connections this is wrong: Queued connections are only processed in the event loop: QThread::exec
But all this works without a GUI, use QCoreApplication instead of QApplication.

jacek
23rd January 2006, 17:51
At least if you have multiple threads with queued connections this is wrong:
Provided that you use Qt4, unlike the author of this thread.