Commit 0998e2e4 authored by Adam Goins's avatar Adam Goins
Browse files

Added optional parameter to emitted signal. Check to ensure captured event is...

Added optional parameter to emitted signal. Check to ensure captured event is still accepted before closing window.
parent e70d885c
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -103,15 +103,27 @@ namespace Isis {
   * signal and ignores the close event.
   *
   * @param event
   *
   *  @internal
   *  @history 2018-04-24 Adam Goins - Added optional parameter QCloseEvent to
   *                          the closeWindow() signal so that the close event can be caught
   *                          and set to rejected by listening applications (such as qnet).
   *                          Fixes an issue where closing qnet and clicking 'cancel' from the
   *                          proceeding popup dialogue would still close the window but leave
   *                          the application running. Fixes #4146.
   */
  void ViewportMainWindow::closeEvent(QCloseEvent *event) {
    if (p_workspace->confirmClose()) {
      emit closeWindow();
      emit closeWindow(event);
      if (event->isAccepted()) {
        MainWindow::closeEvent(event);
      }
      else {
        event->ignore();
      }
    }
    else {
      event->ignore();
    }
  }
}
+7 −1
Original line number Diff line number Diff line
@@ -33,12 +33,18 @@ namespace Isis {
   *           when exception occured
   *  @history 2012-05-29 Steven Lambright - Updated closeEvent() to ask the user to save any
   *                          unsaved modifications to the opened cube. References #854.
   *  @history 2018-04-24 Adam Goins - Added optional parameter QCloseEvent to
   *                          the closeWindow() signal so that the close event can be caught
   *                          and set to rejected by listening applications (such as qnet).
   *                          Fixes an issue where closing qnet and clicking 'cancel' from the
   *                          proceeding popup dialogue would still close the window but leave
   *                          the application running. Fixes #4146.
   */
  class ViewportMainWindow : public MainWindow {
      Q_OBJECT

    signals:
      void closeWindow(); //!< Signal called when the window receives a close event
      void closeWindow(QCloseEvent *event = NULL); //!< Signal called when the window receives a close event

    public slots:
      void displayWarning(std::string &pStr, const std::string &pExStr);