I have a QObject that has multiple slots connected to one of its signals. Is there an order in which of each of these slots are called when the signal is emitted?
+2
A:
Just found it in the Qt documentation. As sepp2k stated, the order is undefined:
If several slots are connected to one signal, the slots will be executed one after the other, in an arbitrary order, when the signal is emitted
Jesse
2009-08-07 21:01:56
+1
A:
As other answers stated, the order is undefined.
If you need an ordered signal/slot mechanism, you can use Boost.Signals library.
frgtn
2009-08-07 21:50:56
+2
A:
While the order is undefined, up to now, in all Qt versions it has been connect()
order, except when Qt::QueuedConnection
is used, in which case, of course, it's not even guaranteed that any or all slots have been executed when emit
returns. Relying on the order is still discouraged, though.