This example shows you why you mustn't use QEventLoop. In short every time you want to make simple warkaround it breaks yourself app.

For compiling you need to have CMake and Qt5. Tested on Linux and Windows.