[Interest] Exiting a Qt app cleanly.

Joseph W Joshua joshua at megvel.me.ke
Fri Apr 12 08:59:31 CEST 2013


On Fri, Apr 12, 2013 <tel:2013>  at 5:49 AM, Joseph W Joshua
<joshua at megvel.me.ke <mailto:joshua at megvel.me.ke> > wrote:

Hi all,

 

I am having a problem in exiting an application.

 

Basically, this is a small GUI application which opens, checks for updates
and then 

starts another executable in the same folder. After launching the other
executable, 

it should exit.

 

The problem is that, after starting the application and calling
qApp->quit();, nothing

Happens.

 

I have checked all forums and past questions here and elsewhere, and they
all point to 

qApp->quit();, which is not working for me.

 

Here is my main.cpp

 

int main(int argc, char *argv[])

{

    QApplication a(argc, argv);

    a.setQuitOnLastWindowClosed(true);

    LauncherDialog w;

    w.show();    

    return a.exec();

}

 

 

Here is the exit part in my LauncherDialog class:

 

void LauncherDialog::closeAll()

{

    qApp->quit();

}

Couple of things to check:
1)Have you set setModal(true) for the dialog? 
 

2)Is closeAll() being called?  If not maybe you are waiting for the other
process to complete execution.

 

 

Regards,

 

Thank you Bhat,

 

setModal worked like a charm.

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130412/478a53f3/attachment.html>


More information about the Interest mailing list