I am working on an small client-server application. The client sends a query and has to wait for an answer. I think the most convenient way is to use a QEventLoop:
connect(&parser, SIGNAL(answer_received()), this, SLOT(react_to_answer()));
...
...
QEventLoop loop;
connect(&parser, SIGNAL(answer_received()), &loop, SLOT(quit()));
this.sendQuery();
loop.exec();
This worked for me at the moment, but what happens, if the signal answer_received()
is emitted very fast, even before loop.exec()
was called? Will my application stuck in the QEventLoop forever?
Thank you!