qApp->quit() should work, unless you invoke openDialog() in a loop or you block the event loop in some way.Originally Posted by beerkg
qApp->quit() should work, unless you invoke openDialog() in a loop or you block the event loop in some way.Originally Posted by beerkg
Sorry I dont quite understand: "unless you invoke openDialog() in a loop". You mean the dialog loop or main application loop? I want to quit after the dialog loop is finished. One thing i've noticed is when I use QMessageBox before qApp->quit() it worked. It looks like Dialog doesnt have enough time to finish its event loop before I use qApp->quit()
I meant something like:Originally Posted by beerkg
So qApp->quit() doesn't work or it works too fast?Originally Posted by beerkg
When I do something like that:
Qt Code:
void Form1::openDialog(){ Dialog *dialog=new Dialog(this); int result=dialog->exec(); qApp->quit(); } delete dialog; }To copy to clipboard, switch view to plain text mode
it works fine, but without this meeage box it doesn't work.
Hi
From the Qt docs:
Regarding qApp->quit(), qApp->exit() etc:
Note that ... this function does return to the caller -- it is event processing that stops.
Therefore try this: First terminate the Qt event loop processing and then end the application with the exit() function from stdlib.h:
Qt Code:
#include <QCoreApplication> #include <stdlib.h> ... { exit(0); }To copy to clipboard, switch view to plain text mode
Regards
Ernst
aMan (11th August 2006)
Bookmarks