mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 22:50:25 -05:00
Store dock state in project
This commit is contained in:
1 parent
7bd429b937
commit
09ea2e7028
8 files changed
+112
-81
No files matched your search
@@ -18,6 +18,11 @@
|
||||
|
||||
#include "RiuDockWidgetTools.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
@@ -350,6 +355,40 @@ QAction* RiuDockWidgetTools::toggleActionForWidget( const ads::CDockManager* doc
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuDockWidgetTools::setDockLayout( RiuMainWindowBase* mainWindow, const QString& layoutName )
|
||||
{
|
||||
if ( mainWindow == nullptr ) return;
|
||||
|
||||
QString activeViewerName;
|
||||
if ( auto activeViewer = RiaGuiApplication::instance()->activeReservoirView() )
|
||||
{
|
||||
activeViewerName = activeViewer->dockWindowName();
|
||||
}
|
||||
|
||||
if ( auto dm = mainWindow->dockManager() )
|
||||
{
|
||||
QByteArray state = RiuDockWidgetTools::defaultDockState( layoutName );
|
||||
if ( dm->restoreState( state, RiuMainWindowBase::DOCKSTATE_VERSION ) )
|
||||
{
|
||||
for ( auto view : mainWindow->viewWindows() )
|
||||
{
|
||||
if ( view->showWindow() && view->dockWidget() )
|
||||
{
|
||||
dm->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, view->dockWidget(), dm->centralWidget()->dockAreaWidget() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( auto dw = dm->findDockWidget( activeViewerName ) )
|
||||
{
|
||||
dw->setAsCurrentTab();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user