Hi all.

I have an application that works with databases. Before it starts executing it shows a dialog that asks for the connection parameters (user, password). I'd like to make that when a user presses the Cancel button, the application must quit.

For example:

Qt Code:
  1. //-------------------------//
  2. int ret = ConnDialog.exec();
  3. if (ret == QDialog::Rejected)
  4. app.quit();
  5. //-------------------------//
  6. app.exec(); // Here starts the main loop
  7. //-------------------------//
To copy to clipboard, switch view to plain text mode 

But it doesn't work. The QApplication::quit() works only inside the main loop.
How can i quit the application before the main loop ? Thnx ...