[Qt-interest] application won't terminate
Kurtis Nusbaum
klnusbaum at gmail.com
Wed Jan 6 00:42:13 CET 2010
Ah yes! That makes sense. Just because there are parts of the function that
need the event loop to execute doesn't mean that the whole function gets
executed in the event loop, only the parts that need to be are. Tried your
solution and it works perfectly. Thanks for the help.
-Kurtis
On Tue, Jan 5, 2010 at 2:18 AM, alexander golks <alex at golks.de> wrote:
> >
> > 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
> *
> */
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100105/a12a146c/attachment.html
More information about the Qt-interest-old
mailing list