[Qt-interest] Signal delivery order?

Sean Harmer sean.harmer at maps-technology.com
Wed Jul 14 18:04:12 CEST 2010


On Wednesday 14 July 2010 16:20:06 Atlant Schmidt wrote:
> Folks:
> 
>   I'm trying to understand the order in which signals are delivered to
> slots.
> 
>   When I look at:
> 
>     http://doc.trolltech.com/4.6.2/signalsandslots.html
> 
>   It first says:
> 
>     If several slots are connected to one signal, the slots will be
> executed one after the other, in the order they have been connected, when
> the signal is emitted.
> 
>   But later, it seems to take back that promise by saying:
> 
>     If on the other hand you want to call two different error functions
> when the number overflows, simply connect the signal to two different
> slots. Qt will call both (in arbitrary order).
> 
> 
>   Depending on the implementation details, I could believe that, within a
> single thread, either statement is true (that slots are handed the signal
> in the order in which they were originally connected or that slots are
> handed the signals in an arbitrary order); clearly, the second statement
> subsumes the first and it's easier for the trolls if it's the latter. It's
> also safer for me if *I BELIEVE* it's the latter, even if it's sometimes
> the former, but shouldn't the documentation be self-consistent? Does
> anyone know which statement ("connection order" vs. "arbitrary order") is
> more true? And can you correct the documentation? ;-)

Technically I think you cannot rely upon the order being the order in which 
the slots are connected as the implementation may change in the future. The 
current implementation maintains the order in which the connects were made.

However, Thiago and other trolls have stated (on this list and at DevDays) 
that they cannot ever really change the current behaviour because too many 
existing customer apps rely on it.

Sean



More information about the Qt-interest-old mailing list