Qt-Advanced-Docking-System/examples/dockindock/perspectiveactions.cpp
jporcher 0e8e563654
Add dockindock example (#308)
* Add dockdepth1 example

* Fix compilation (include assert.h)

* Replace dockdepth1 by dockindock
2021-04-21 06:37:19 +02:00

40 lines
1.1 KiB
C++

#include "perspectiveactions.h"
#include "dockindock.h"
#include "perspectives.h"
#include <QMenu>
using namespace QtAdsUtl;
//////////////////////////////
// LoadPerspectiveAction
//////////////////////////////
LoadPerspectiveAction::LoadPerspectiveAction( QMenu* parent, const QString& name, QtAdsUtl::DockInDockWidget& dockManager ) :
QAction( name, parent ),
name( name ),
dockManager( dockManager )
{
connect( this, SIGNAL(triggered()), this, SLOT(load()) );
}
void LoadPerspectiveAction::load()
{
dockManager.getPerspectivesManager()->openPerspective( name, dockManager );
}
//////////////////////////////
// RemovePerspectiveAction
//////////////////////////////
RemovePerspectiveAction::RemovePerspectiveAction( QMenu* parent, const QString& name, QtAdsUtl::DockInDockWidget& dockManager ) :
QAction( name, parent ),
name( name ),
dockManager( dockManager )
{
connect( this, SIGNAL(triggered()), this, SLOT(remove()) );
}
void RemovePerspectiveAction::remove()
{
dockManager.getPerspectivesManager()->removePerspective( name );
}