mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7236 Rewrite window closing in ResInsight
This commit is contained in:
@@ -283,25 +283,19 @@ void RiuMainWindow::cleanupGuiBeforeProjectClose()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::closeEvent( QCloseEvent* event )
|
||||
{
|
||||
this->saveWinGeoAndDockToolBarLayout();
|
||||
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
if ( app->isMainPlotWindowVisible() )
|
||||
{
|
||||
event->ignore(); // Make Qt think we don't do anything, otherwise it closes the window.
|
||||
this->hide(); // Instead we just hide it.
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !app->askUserToSaveModifiedProject() )
|
||||
if ( !app->isMainPlotWindowVisible() )
|
||||
{
|
||||
event->ignore();
|
||||
return;
|
||||
if ( !app->askUserToSaveModifiedProject() )
|
||||
{
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this->saveWinGeoAndDockToolBarLayout();
|
||||
this->hideAllDockWidgets();
|
||||
app->closeMainPlotWindowIfOpenButHidden();
|
||||
app->closeProject();
|
||||
QMainWindow::closeEvent( event );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -197,26 +197,18 @@ void RiuPlotMainWindow::cleanUpTemporaryWidgets()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuPlotMainWindow::closeEvent( QCloseEvent* event )
|
||||
{
|
||||
this->saveWinGeoAndDockToolBarLayout();
|
||||
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
if ( app->isMain3dWindowVisible() )
|
||||
if ( !app->isMain3dWindowVisible() )
|
||||
{
|
||||
event->ignore();
|
||||
this->hide();
|
||||
return;
|
||||
if ( !app->askUserToSaveModifiedProject() )
|
||||
{
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !app->askUserToSaveModifiedProject() )
|
||||
{
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
this->saveWinGeoAndDockToolBarLayout();
|
||||
this->hideAllDockWidgets();
|
||||
app->closeMainWindowIfOpenButHidden();
|
||||
app->closeProject();
|
||||
QMainWindow::closeEvent( event );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user