[Qt-interest] replace QCoreApplication by QApplication?

Alexander Poddey alexander.poddey at gmx.net
Sun Aug 30 12:40:10 CEST 2009


hi thiago,

thank you for your answer.
the extra curly brakets around QCoreApplication solved the problem.
why that?

both, reusing 'app' or using 'app' and 'appgui' works. which way is 
preferable? 

Thank you.

>
> Try it like this:
>
> int main(int argc, char **argv)
> {
>     bool doGui = false;
>     {
>         QCoreApplication app(argc, argv);
>         /* do something */
>     }
>
>     if (doGui)
>     {
>         QApplication app(argc, argv);
>
>         MainWindow window;
>         window.show();
>
>         app.exec();
>     }
> }





More information about the Qt-interest-old mailing list