mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9935 Avoid storing dock layout if window never has been visible
Do not save the state if the window never has been visible. This will write out a state that is not valid.
This commit is contained in:
@@ -63,6 +63,7 @@ RiuMainWindowBase::RiuMainWindowBase()
|
||||
, m_showFirstVisibleWindowMaximized( true )
|
||||
, m_blockSubWindowActivation( false )
|
||||
, m_blockSubWindowProjectTreeSelection( false )
|
||||
, m_hasBeenVisible( false )
|
||||
, m_windowMenu( nullptr )
|
||||
, m_mdiArea( nullptr )
|
||||
{
|
||||
@@ -214,6 +215,10 @@ QString mainWindowDockWidgetSettingsKey( const QString& settingsFolderName )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindowBase::saveWinGeoAndDockToolBarLayout()
|
||||
{
|
||||
// Do not save the state if the window never has been visible. This will write out a state that is not valid.
|
||||
// https://github.com/OPM/ResInsight/issues/9935
|
||||
if ( !m_hasBeenVisible ) return;
|
||||
|
||||
// Company and appname set through QCoreApplication
|
||||
QSettings settings;
|
||||
|
||||
@@ -787,3 +792,13 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu()
|
||||
m_windowMenu->addAction( cascadeWindowsAction );
|
||||
m_windowMenu->addAction( closeAllSubWindowsAction );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindowBase::showEvent( QShowEvent* event )
|
||||
{
|
||||
m_hasBeenVisible = true;
|
||||
|
||||
QMainWindow::showEvent( event );
|
||||
}
|
||||
|
||||
@@ -117,6 +117,8 @@ protected:
|
||||
|
||||
virtual QStringList windowsMenuFeatureNames() = 0;
|
||||
|
||||
void showEvent( QShowEvent* event ) override;
|
||||
|
||||
protected slots:
|
||||
void slotDockWidgetToggleViewActionTriggered();
|
||||
void slotRefreshHelpActions();
|
||||
@@ -156,6 +158,7 @@ private:
|
||||
bool m_showFirstVisibleWindowMaximized;
|
||||
bool m_blockSubWindowActivation;
|
||||
bool m_blockSubWindowProjectTreeSelection;
|
||||
bool m_hasBeenVisible;
|
||||
|
||||
ads::CDockManager* m_dockManager;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user