Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use new signal/slot connetion and minor fixes: followup 3d7a460
  • Loading branch information
slarosa committed Mar 19, 2018
1 parent f6f7027 commit 53244d1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/app/qgisapp.cpp
Expand Up @@ -1913,8 +1913,8 @@ void QgisApp::createActions()
connect( mActionPasteAsNewMemoryVector, &QAction::triggered, this, [ = ] { pasteAsNewMemoryVector(); } );
connect( mActionCopyStyle, &QAction::triggered, this, [ = ] { copyStyle(); } );
connect( mActionPasteStyle, &QAction::triggered, this, [ = ] { pasteStyle(); } );
connect( mActionCopyLayer, &QAction::triggered, this, [ = ] { copyLayer(); } );
connect( mActionPasteLayer, &QAction::triggered, this, [ = ] { pasteLayer(); } );
connect( mActionCopyLayer, &QAction::triggered, this, &QgisApp::copyLayer );
connect( mActionPasteLayer, &QAction::triggered, this, &QgisApp::pasteLayer );
connect( mActionAddFeature, &QAction::triggered, this, &QgisApp::addFeature );
connect( mActionCircularStringCurvePoint, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mCircularStringCurvePoint ); } );
connect( mActionCircularStringRadius, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mCircularStringRadius ); } );
Expand Down Expand Up @@ -8603,7 +8603,6 @@ void QgisApp::pasteLayer()

if ( !loaded )
{
QgsDebugMsg( errorMessage );
messageBar()->pushMessage( tr( "Error pasting layer" ), errorMessage, Qgis::Warning );
}
}
Expand Down
18 changes: 13 additions & 5 deletions src/app/qgsapplayertreeviewmenuprovider.cpp
Expand Up @@ -56,11 +56,15 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
{
// global menu
menu->addAction( actions->actionAddGroup( menu ) );
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionEditPaste.svg" ) ),
tr( "Paste Layer/Group" ), QgisApp::instance(), SLOT( pasteLayer() ) );

menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionExpandTree.svg" ) ), tr( "&Expand All" ), mView, SLOT( expandAll() ) );
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCollapseTree.svg" ) ), tr( "&Collapse All" ), mView, SLOT( collapseAll() ) );
menu->addSeparator();
if ( QgisApp::instance()->clipboard()->hasFormat( QGSCLIPBOARD_MAPLAYER_MIME ) )
{
QAction *actionPasteLayerOrGroup = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionEditPaste.svg" ) ), tr( "Paste Layer/Group" ), menu );
connect( actionPasteLayerOrGroup, &QAction::triggered, QgisApp::instance(), &QgisApp::pasteLayer );
menu->addAction( actionPasteLayerOrGroup );
}

// TODO: update drawing order
}
Expand Down Expand Up @@ -97,7 +101,9 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
menu->addAction( tr( "Copy Group" ), QgisApp::instance(), SLOT( copyLayer() ) );
if ( QgisApp::instance()->clipboard()->hasFormat( QGSCLIPBOARD_MAPLAYER_MIME ) )
{
menu->addAction( tr( "Paste Layer/Group" ), QgisApp::instance(), SLOT( pasteLayer() ) );
QAction *actionPasteLayerOrGroup = new QAction( tr( "Paste Layer/Group" ), menu );
connect( actionPasteLayerOrGroup, &QAction::triggered, QgisApp::instance(), &QgisApp::pasteLayer );
menu->addAction( actionPasteLayerOrGroup );
}

menu->addAction( tr( "Save As Layer Definition File…" ), QgisApp::instance(), SLOT( saveAsLayerDefinition() ) );
Expand Down Expand Up @@ -215,7 +221,9 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
}

menu->addSeparator();
menu->addAction( tr( "Copy Layer" ), QgisApp::instance(), SLOT( copyLayer() ) );
QAction *actionCopyLayer = new QAction( tr( "Copy Layer" ), menu );
connect( actionCopyLayer, &QAction::triggered, QgisApp::instance(), &QgisApp::copyLayer );
menu->addAction( actionCopyLayer );

if ( vlayer )
{
Expand Down
5 changes: 4 additions & 1 deletion src/ui/qgisapp.ui
Expand Up @@ -3001,7 +3001,10 @@ Acts on currently active editable layer</string>
<normaloff>:/images/themes/default/mActionEditPaste.svg</normaloff>:/images/themes/default/mActionEditPaste.svg</iconset>
</property>
<property name="text">
<string>Paste Layer</string>
<string>Paste Layer/Group</string>
</property>
<property name="toolTip">
<string>Paste Layer/Group</string>
</property>
</action>
</widget>
Expand Down

0 comments on commit 53244d1

Please sign in to comment.