PDA

View Full Version : How can I get a return value from a signal and slot



knobby67
15th August 2014, 10:18
Hi All,
I've been trying to work out how to get a return value from a signal/slot. But it seems I can't from googling. Basically what I have is a signal is sent to an error checker slot, the error checker checks everything if there's are error I want a error_flag set and the caller to drop out. So in pseudo code





do
{


game loop


}while( signal calls error check slot, if error set true if not flase and drop out )



so basically how to get the error back to the fuction that calls the signal
Thanks in advance

anda_skoa
15th August 2014, 10:30
While a thread-local signal/slot connection is basically a direct function call and you can use input/output parameters (references or pointers), you should at least consider that a signal can be connected to more than one slot.

Of course that is something you control, but it is often an indicator that a different kind of interaction pattern is more suitable than signal/slot.
Like directly calling the other object's method.

Cheers,
_