[Qt-interest] How to quit Qt app after browser opening?

程梁 chengliang.soft at gmail.com
Thu Jun 2 03:40:04 CEST 2011


Thanks! It does work!

2011/6/1 Nikos Chantziaras <realnc at arcor.de>

> On 06/01/2011 03:36 PM, 程梁 wrote:
> > Hi, there! I tried to develop an application to open the default web
> > site using Qt.
> >
> > I use QDesktopServices::openUrl(theURL); to do this. But the problem is
> > when my default browser opens, the Qt application will not quit. What I
> > want to get is, after the browser opens, this Qt application quit
> > automatically. But I did not find how to do this. I tried this code:
> >      if(QDesktopServices::openURL())
> >          qApp->quit();
> > but it doesn't work. Here is my whole code, could you tell me how to
> > solve this problem?
> >
> >          if(QDesktopServices::openUrl(QUrl(serverURL,
>  QUrl::TolerantMode)))  {
> >
> >              app.quit();
>
> app.quit() is only useful after the application has started (meaning
> after app.exec()).  So in your case, simply replace app.quit() with
> return 0.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>



-- 
Cheng Liang
from: chengliang.soft at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110602/0bf5f4f7/attachment.html 


More information about the Qt-interest-old mailing list