What is meant by Local Event loop in Modal Dialog Context?
-
Qt doc says:
void QDialog::done ( int r ) [virtual slot]Closes the dialog and sets its result code to r. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return r.
If The main event loop is alive and dialog is still in main thread. What does it meant by local event loop?
-
QDialog::exec()/QMenu::exec()/... will start a local event loop.
QDialog::open()/QMenu::popup()/... will not start a local event loopembedded event loop is rather easy to understand, when embededed eventloop running, it will look like this
@
while(...) //started by QCoreApplication::exec()
{
while(....) //embeded eventloop
{
processEvents(...);
}
processEvents(...);
}
@ -
@
myDialog.exec();inside myDialog slots..
{
///////
done(1);//here the Dialog invisible
QProgressDialog dia;
////dialog related parameters
foreach(---){
//update progress ba
qApp->processEvents();//does this line create crash,if written after done()?
//////
}}
@
[quote author="1+1=2" date="1387960808"]QDialog::exec()/QMenu::exec()/... will start a local event loop.
QDialog::open()/QMenu::popup()/... will not start a local event loopembedded event loop is rather easy to understand, when embededed eventloop running, it will look like this
@
while(...) //started by QCoreApplication::exec()
{
while(....) //embeded eventloop
{
processEvents(...);
}
processEvents(...);
}
@[/quote]