[Qt-interest] replace QCoreApplication by QApplication?
Thiago Macieira
thiago.macieira at trolltech.com
Sun Aug 30 11:37:14 CEST 2009
Em Domingo 30. Agosto 2009, às 11.01.39, você escreveu:
> int ain(int argc, char *argv[])
> {
> QCoreApplication app(argc, argv);
>
> //=== extract command line options & start processing
> // non-gui commands
> LeC ommand lc;
> lc.process(app); //processes the command line,
> //lets LeParam.tgui() return 'true'
>
> //=== try to start gui if needed
> if(LeParam.tgui()){
> //GET RID OF QCoreApplication ?
> QApplication appgui(argc, argv);
>
>
> MainWindow window;
> window.resize(640, 480);
> window.show();
>
>
> appgui.exec();
> }//if(LeParam.tgui())
> }
>
> -----------------------------
Hi Alexander
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();
}
}
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Product Manager - Nokia, Qt Development Frameworks
Sandakerveien 116, NO-0402 Oslo, Norway
Qt Developer Days 2009 | Registration Now Open!
Munich, Germany: Oct 12 - 14 San Francisco, California: Nov 2 - 4
http://qt.nokia.com/qtdevdays2009
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090830/23a8aad8/attachment.bin
More information about the Qt-interest-old
mailing list