[Interest] z-order for Qt's signals and slots

Frans Klaver fransklaver at gmail.com
Wed Nov 23 07:54:42 CET 2011


On Wed, 23 Nov 2011 07:45:16 +0100, Bo Thorsen <bo at fioniasoftware.dk>  
wrote:

> Den 23-11-2011 06:21, Sathishkumar Duraisamy skrev:
>
>> Why can't we have z-order for signals and slots, taking control for of
>> order the slots will be called. For some peculiar situation, that the
>> programmer feels it would be best if it is called the slots after
>> finishing all other slots. Or is there way to achieve the same?
>
> If you need ordering, call the functions directly. Sometimes I see cases
> for this too, but the interface for controlling it would be annoying,
> and it's rarely necessary. So my POV is that you should just use a
> different way if you need ordered calls.

I would even take this further, and say that if you needed z-ordering in  
signal/slot connections, you're missing the entire point of signals and  
slots. If you rely on a certain order, you have two options. Either your  
code either isn't modular enough (A::x() has to be called before B::y()  
usually signals that), or you should take the approach proposed by Bo  
(A::z() { x(); y(); }.

Cheers,
Frans



More information about the Interest mailing list