You are not logged in.

1

Thursday, April 19th 2007, 4:54pm

Quiting program

Hi all,

I've created a program for some updating purposes... It have a main window, and i want it to exit after the process is done. But after the window disappear, I press Ctrl+Alt+Del and my program "KUS.exe" process still "alive". How can I totally destroy or quit the whole program??

below is my current code from main.cpp:

-------------------------------------------
int main(int argc, char *argv[] )
{
QApplication app(argc, argv);
KusWidget kus;
kus.show();
kus.compare(argv[1],argv[2]);
kus.close();

app.exit(0);
return app.exec();
}

-------------------------------------------

Thanks & regards,
Max.

Krasu

Intermediate

  • "Krasu" is male

Posts: 234

Location: Republic of Belarus

  • Send private message

2

Thursday, April 19th 2007, 5:28pm

RE: Quiting program

What is your Qt version ?

3

Friday, April 20th 2007, 5:34am

RE: Quiting program

Hi, Thanks for reply, my version is 4.2.3. Does that matter??


Thanks & regards,
Max.

4

Friday, April 20th 2007, 1:06pm

RE: Quiting program

app.exit()
"Note that unlike the C library function of the same name, this function does return to the caller -- it is event processing that stops."

So your app.exec() gets called which is why the process is still alive.

Also app.exit() is really intended for returning from app.exec() so it's really doing nothing there anyway.