[Interest] Relationship between a QEventLoop and QCoreApplication::exec().
Uwe Rathmann
Uwe.Rathmann at tigertal.de
Thu Aug 4 06:21:44 CEST 2016
On Wed, 03 Aug 2016 13:41:51 -0700, Thiago Macieira wrote:
> It's still a source of errors because the nesting counter can be
> incremented in different ways, depending on what triggered the event. So
> the recommendation remains: avoid nesting like the plague.
void doIt()
{
...
int option = askForOption();
...
if ( doYouReallyWantTo( option ) )
{
...
}
}
Having to write this code without nested loops ( f.e. QDialog::exec() )
leads to 3 method ...
- before askForOption
- between askForOption and doYouReallyWantTo
- after doYouReallyWantTo
... where you always have the problem to transfer the variables from the
stack ( here option ).
Once your code ends up in sequences of between-GUI-interactions methods
you will have way more problems, than what nested event loops might be.
So yes nested loops might be a problem, but not using them is IMHO the
wrong consequence.
Uwe
More information about the Interest
mailing list