PDA

View Full Version : execution of slots



smalls
22nd January 2006, 20:26
hi all,

i have connected a signal A with a slot T and i would like to know what would happen if:

1) A is fired -> T is invoked the first time
2) A is fired again, while the first call of T still is in progress

now, does qt start the slot T directly such that several "instances" of the method are running
or does it wait until the first invocation of T terminates???

(by the way, it is a simple GUI, no multi-threaded app)

thanks

smalls

jacek
22nd January 2006, 20:38
now, does qt start the slot T directly such that several "instances" of the method are running or does it wait until the first invocation of T terminates???
Direct connections behave just like function calls. Every time you emit a signal, Qt will call the first connected slot, when it returns second slot will be invoked and so on. If there is an emit statement inside a slot, Qt will start invoking apropriate slots immediately.

Queued connections behave like custom events from Qt3 --- emit statement posts an event to apropriate event queue and slot is invoked when that event loop picks up this event.

Codepoet
22nd January 2006, 20:38
Since you are single-threaded the calls are done imediately by the main / GUI thread. That means emit calls the slots one after the other - only the order is undefined.