Use the second method, it's beautiful
Your code from the first one is incorrect, anyway. You might employ a local event loop to make it work, but it's a bad idea.
How to use the code? Well... after the exec() call you will either have your reply in the reply object ready to read or a timeout will have occured. The "if" block is there to check which one occured. Then simply do your stuff.
Bookmarks