Skip to content
Permalink
Browse files

[needs-docs] Add "delete layout" action to layout designer menu

Fixes #10436
  • Loading branch information
nyalldawson committed Dec 5, 2017
1 parent 88682b2 commit b6dab6ff48bc6a0e40d3ca79e0d44fabde9df9bd
@@ -23,6 +23,7 @@
#include "qgslayout.h"
#include "qgslayoutappmenuprovider.h"
#include "qgslayoutcustomdrophandler.h"
#include "qgslayoutmanager.h"
#include "qgslayoutview.h"
#include "qgslayoutviewtooladditem.h"
#include "qgslayoutviewtooladdnodeitem.h"
@@ -160,6 +161,7 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
connect( mActionSaveProject, &QAction::triggered, this, &QgsLayoutDesignerDialog::saveProject );
connect( mActionNewLayout, &QAction::triggered, this, &QgsLayoutDesignerDialog::newLayout );
connect( mActionLayoutManager, &QAction::triggered, this, &QgsLayoutDesignerDialog::showManager );
connect( mActionRemoveLayout, &QAction::triggered, this, &QgsLayoutDesignerDialog::deleteLayout );

connect( mActionShowGrid, &QAction::triggered, this, &QgsLayoutDesignerDialog::showGrid );
connect( mActionSnapGrid, &QAction::triggered, this, &QgsLayoutDesignerDialog::snapToGrid );
@@ -1392,6 +1394,16 @@ void QgsLayoutDesignerDialog::renameLayout()
currentLayout()->setName( newTitle );
}

void QgsLayoutDesignerDialog::deleteLayout()
{
if ( QMessageBox::question( this, tr( "Delete Layout" ), tr( "Are you sure you want to delete the layout “%1”?" ).arg( currentLayout()->name() ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes )
return;

currentLayout()->project()->layoutManager()->removeLayout( currentLayout() );
close();
}

void QgsLayoutDesignerDialog::paste()
{
QPointF pt = mView->mapFromGlobal( QCursor::pos() );
@@ -273,6 +273,7 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner
void newLayout();
void showManager();
void renameLayout();
void deleteLayout();

private:

@@ -103,6 +103,7 @@
<addaction name="separator"/>
<addaction name="mActionNewLayout"/>
<addaction name="mActionDuplicateLayout"/>
<addaction name="mActionRemoveLayout"/>
<addaction name="mActionLayoutManager"/>
<addaction name="separator"/>
<addaction name="mActionLayoutProperties"/>
@@ -1160,6 +1161,18 @@
<string>Rename layout</string>
</property>
</action>
<action name="mActionRemoveLayout">
<property name="icon">
<iconset resource="../../../images/images.qrc">
<normaloff>:/images/themes/default/mActionDeleteSelected.svg</normaloff>:/images/themes/default/mActionDeleteSelected.svg</iconset>
</property>
<property name="text">
<string>Delete Layout…</string>
</property>
<property name="toolTip">
<string>Delete layout</string>
</property>
</action>
</widget>
<resources>
<include location="../../../images/images.qrc"/>

0 comments on commit b6dab6f

Please sign in to comment.
You can’t perform that action at this time.