I am (trying) to write a Cascades application that includes many calls to various Web Services. I have got this working fine in my main Application class but I would like to be able to call another class – a Services Manager class if you will – and get it to return a value to my calling Application class when the service call has been processed by the Services Manager class and has completed.
Is this a good design? This is the route I would take in Java but I am completely new to C++ and QT. Could I potentially use an emit and signal process to produce this functionality?
Thanks
Yes, if I read your question correctly.
It’s entirely reasonable for the ServicesManager class to communicate with the Application class via signals / slots. It kind of sounds like these are running in different threads, but that’s fine with Qt signals/slots. Also, you can subclass the signal class to send a custom payload (or just tell the receiver “hey, I’m done, query me for the results”).
If async is what you want, have a look at this pretty good explanation:
Qt Signals/Slots across Threads