mirror of
https://github.com/OPM/ResInsight.git
synced 2026-11-24 14:58:13 -06:00
Restore "Use Layout" functionality for user defined window layouts. (#15125)
* Restore "Use Layout" functionality for user defined window layouts.
This commit is contained in:
5 files changed
+18
-9
No files matched your search
@@ -368,7 +368,7 @@ QAction* RiuDockWidgetTools::toggleActionForWidget( const ads::CDockManager* doc
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuDockWidgetTools::setDockLayout( RiuMainWindowBase* mainWindow, const QString& layoutName )
|
||||
void RiuDockWidgetTools::setDockLayout( RiuMainWindowBase* mainWindow, const QString& layoutName, bool userLayout )
|
||||
{
|
||||
if ( mainWindow == nullptr ) return;
|
||||
|
||||
@@ -380,8 +380,17 @@ void RiuDockWidgetTools::setDockLayout( RiuMainWindowBase* mainWindow, const QSt
|
||||
|
||||
if ( auto dm = mainWindow->dockManager() )
|
||||
{
|
||||
QByteArray state = RiuDockWidgetTools::defaultDockState( layoutName );
|
||||
if ( dm->restoreState( state, RiuMainWindowBase::DOCKSTATE_VERSION ) )
|
||||
bool loadOk = false;
|
||||
if ( userLayout )
|
||||
{
|
||||
loadOk = dm->openPerspective( layoutName );
|
||||
}
|
||||
else
|
||||
{
|
||||
QByteArray state = RiuDockWidgetTools::defaultDockState( layoutName );
|
||||
loadOk = dm->restoreState( state, RiuMainWindowBase::DOCKSTATE_VERSION );
|
||||
}
|
||||
if ( loadOk )
|
||||
{
|
||||
for ( auto view : mainWindow->viewWindows() )
|
||||
{
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
static QString dockStateHideAllPlotWindowName();
|
||||
static QString dockStateHideAll3DWindowName();
|
||||
|
||||
static void setDockLayout( RiuMainWindowBase* mainWindow, const QString& layoutName );
|
||||
static void setDockLayout( RiuMainWindowBase* mainWindow, const QString& layoutName, bool userLayout = false );
|
||||
|
||||
static QAction* toggleActionForWidget( const ads::CDockManager* dockManager, const QString& dockWidgetName );
|
||||
|
||||
|
||||
@@ -694,13 +694,13 @@ void RiuMainWindowBase::setDefaultDockLayout()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindowBase::setDockLayout()
|
||||
void RiuMainWindowBase::setUserDockLayout()
|
||||
{
|
||||
QAction* action = dynamic_cast<QAction*>( sender() );
|
||||
if ( action )
|
||||
{
|
||||
QString layoutName = action->text();
|
||||
RiuDockWidgetTools::setDockLayout( this, layoutName );
|
||||
RiuDockWidgetTools::setDockLayout( this, layoutName, true /* user layout */ );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,7 +816,7 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu()
|
||||
for ( auto& layout : names )
|
||||
{
|
||||
QAction* chooseLayoutAction = layoutsMenu->addAction( layout );
|
||||
connect( chooseLayoutAction, SIGNAL( triggered() ), this, SLOT( setDockLayout() ) );
|
||||
connect( chooseLayoutAction, SIGNAL( triggered() ), this, SLOT( setUserDockLayout() ) );
|
||||
QAction* deleteLayoutAction = deleteLayoutMenu->addAction( layout );
|
||||
connect( deleteLayoutAction, SIGNAL( triggered() ), this, SLOT( deleteDockLayout() ) );
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ protected slots:
|
||||
void slotRefreshUndoRedoActions();
|
||||
|
||||
void setDefaultDockLayout();
|
||||
void setDockLayout();
|
||||
void setUserDockLayout();
|
||||
void deleteDockLayout();
|
||||
void saveDockLayout();
|
||||
void exportDockLayout();
|
||||
|
||||
Reference in new issue
Block a user