Dear Qt users,
I know this topic has been discussed all over the web. The usual suggestion is to use this: QEventLoop loop;
loop.connect(object, SIGNAL(operationCompleted()), SLOT(quit()));
object->startOperation();
loop.exec(QEventLoop::AllEvents|QEventLoop::WaitForMoreEvents);
However I was wondering: what happens if the signal is emitted before we call loop.exec()?
Could we stay stuck in the exec()? Particularly if the startOperation() calls processEvents?
I have used this trick a few times in the past, but I’m now struggling with an asynchronous activex.
I can confirm that the operationCompleted() signal is emitted. However the loop never quits.
I’ve noticed that startOperation() takes a little time (500msec) and I don’t know what happens there.
↧