Quote Originally Posted by aamer4yu View Post
Can u show the code of the exitApplication slot ?
Here it is:

Qt Code:
  1. // Exit application SLOT
  2. void Simulator::exitApplication() {
  3.  
  4. // Check if an evolution or a test are in progress
  5. if ((evolutionInProgress) || (testInProgress)) {
  6.  
  7. // Pause the simulation
  8. mainWindow->checkBox_PauseEvolution->setChecked(true);
  9.  
  10. // Show a dialog box asking confirmation to the user
  11. int reply;
  12. if (evolutionInProgress) reply = QMessageBox::warning(this, tr("Application exit"),
  13. tr("An evolution is in progress.\nAre you really sure you want to exit now?"),
  14. QMessageBox::No | QMessageBox::Default, QMessageBox::Yes | QMessageBox::Escape);
  15. else reply = QMessageBox::warning(this, tr("Application exit"),
  16. tr("A test is in progress.\nAre you really sure you want to exit now?"),
  17. QMessageBox::No | QMessageBox::Default, QMessageBox::Yes | QMessageBox::Escape);
  18.  
  19. // Check the answer provided by the user (exit or not)
  20. if (reply == QMessageBox::Yes) {
  21.  
  22. // If an evolution is running, ask to the user if he'd like to save the population
  23. if ((currentGeneration != 0) && (evolutionInProgress)) {
  24. int answer = QMessageBox::question(this,
  25. tr("Save current population"), tr("Do you want to save the current population, in order to restore the simulation later?"),
  26. QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape);
  27. if (answer == QMessageBox::Yes) {
  28. savePopulation();
  29. QString directoryName;
  30. directoryName = seedDirectory + "/Gen_" + QString::number(currentGeneration);
  31. QMessageBox::information(this,
  32. tr("Population saved"), tr("The population has been saved into the directory:\n%1").arg(directoryName));
  33. }
  34. }
  35.  
  36. // Quit the application
  37. ::exit(0);
  38.  
  39. } else {
  40.  
  41. // Return to the simulation
  42. mainWindow->checkBox_PauseEvolution->setChecked(false);
  43.  
  44. }
  45.  
  46. } else { // If no simulations or tests are in progress, directly quit the application
  47.  
  48. emit confirmClosing();
  49.  
  50. }
  51.  
  52. }
To copy to clipboard, switch view to plain text mode 

Many thanks for your help. It's really appreciated!

Cheers,
Fabio

PS: sorry but I had few very long lines that I had to copy here inserting few returns.