I have a Button connected on click with myfuntion see below.
I'm using a QEventLoop because I am waiting for an event, wich will call _myEventLoop.exit(0);
When I click the button two times in a row without waiting for the event to happen I get the error message :
QEventLoop::exec: instance 0x22f47378 has already called exec()
I do a call to exit(1) before calling exec() but it seems that this exit returns immediately, then the function passe by exec(), since it is still running return 1, myfunction returns and only then the first exec() return with 1.
How can i be sure that the previous call to exec() has returned before continuing ?
void myfuntion()
{
_myEventLoop.exit(1);
if(_myEventLoop.exec() == 0)
{
// DoSomething
}
}