[Qt-interest] application won't terminate
alexander golks
alex at golks.de
Tue Jan 5 09:18:54 CET 2010
>
> Fernec, isn't it weird that the qApp->quit() doesn't work? I had actually
> tried that solution before but like you found, I couldn't get it to work
> either. Your last solution works I'm sure, but it's not the clean close that
> I'd like to see. I do some special clean up as evidenced by my closeEvent
> function.
>
> Marek, putting the check in the constructor doesn't seem to work.
>
> -Kurtis
>
it's not so weird as you might think.
QCoreApplication::quit() calls QCoreApplication::exit(0) which sets every eventloop in QCoreApplication to exit.
see:
void QCoreApplication::exit(int returnCode)
in your qt sources.
so as long your eventloop didn't start, there is nothing to exit.
and after you wanted to exit, you start your event loop.
same for the constructor solution.
perhaps something like this might help, my tests worked with your first code example:
/*
* new trigger method
*/
void MainWindow::doCheckPassword()
{
QTimer::singleShot(50,this,SLOT(checkPassword()));
}
/*
* and modified main()
*/
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
w.doCheckPassword();
return a.exec();
}
but for this, checkPassword has to be a slot now...
now the eventloop gets some time to start.
i wonder if there's a more qt'ish solution, more clean.
what if 50 msecs are over, before the eventloop is available?
--
/*
* Backups? We doan *NEED* no steenking baX%^~,VbKx NO CARRIER
*
*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100105/4e7b1567/attachment.bin
More information about the Qt-interest-old
mailing list