When I try to close my Qt program, it just keeps running in the background though there's no window anymore.

Basically, I would like to know what I should do so it closes properly when I click the red cross on my main window (which has no parent).

Following this link, I tried a few things like :

QApplication app(argc, argv);
//...
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
return app.exec();

or

QApplication app(argc, argv);
//...
app.setQuitOnLastWindowClosed(true);
return app.exec();

but neither work, the process still stays in memory, after the cross is clicked.

Then, how can I close correctly my program ?

Edit
Report