Skip to content

Commit

Permalink
Fixed non closing of SPIERSview application on macOS when file is not…
Browse files Browse the repository at this point in the history
… dirty

This fixes the issue where the SPIERSview application stays open in macOS after pressing the 'Red Cross' but were the GUI is removed. This needs testing on Windows to see if it is going to cause problems... if so some IF definition staments can be added to make it macOS only.
  • Loading branch information
alanspencer committed Jun 13, 2020
1 parent b2f411e commit 811b4ef
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions SPIERSview/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2811,6 +2811,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
if (isVaxmlMode == true)
{
event->accept();
QCoreApplication::quit();
return;
}

Expand All @@ -2823,7 +2824,11 @@ void MainWindow::closeEvent(QCloseEvent *event)
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
int ret = msgBox.exec();
if (ret == QMessageBox::Yes) QCoreApplication::quit();

if (ret == QMessageBox::Yes) {
QCoreApplication::quit();
}

event->ignore();
return;
}
Expand All @@ -2842,13 +2847,20 @@ void MainWindow::closeEvent(QCloseEvent *event)
event->accept();
QCoreApplication::quit();
}
else if (ret == QMessageBox::Cancel) event->ignore();
else if (ret == QMessageBox::Cancel) {
event->ignore();
return;
}
else if (ret == QMessageBox::Discard)
{
event->accept();
QCoreApplication::quit();
}
}

// If this has not been caught above then let close the application
event->accept();
QCoreApplication::quit();
}

/**
Expand Down

0 comments on commit 811b4ef

Please sign in to comment.