First a comment:
Not sure what the effect of this code is:
Qt Code:
  1. void MainWindow::closeEvent(QCloseEvent * event)
  2. {
  3. qApp->exit();
  4. delete qApp;
  5. }
To copy to clipboard, switch view to plain text mode 
because your window is the main application window, the application will destroy it as part of its exit process.
But you are deleting the application before you are deleting the window, so I am not sure if it ends in a defined state, and if so what that state is.

You can however try:
Qt Code:
  1. void MainWindow::closeEvent(QCloseEvent * event)
  2. {
  3. qApp->exit();
  4. delete qApp; //this leaves garbage in the pointer.
  5. qApp = NULL;
  6. }
To copy to clipboard, switch view to plain text mode