Skip to content

Commit 53244d1

Browse files
committed
use new signal/slot connetion and minor fixes: followup 3d7a460
1 parent f6f7027 commit 53244d1

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

src/app/qgisapp.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1913,8 +1913,8 @@ void QgisApp::createActions()
19131913
connect( mActionPasteAsNewMemoryVector, &QAction::triggered, this, [ = ] { pasteAsNewMemoryVector(); } );
19141914
connect( mActionCopyStyle, &QAction::triggered, this, [ = ] { copyStyle(); } );
19151915
connect( mActionPasteStyle, &QAction::triggered, this, [ = ] { pasteStyle(); } );
1916-
connect( mActionCopyLayer, &QAction::triggered, this, [ = ] { copyLayer(); } );
1917-
connect( mActionPasteLayer, &QAction::triggered, this, [ = ] { pasteLayer(); } );
1916+
connect( mActionCopyLayer, &QAction::triggered, this, &QgisApp::copyLayer );
1917+
connect( mActionPasteLayer, &QAction::triggered, this, &QgisApp::pasteLayer );
19181918
connect( mActionAddFeature, &QAction::triggered, this, &QgisApp::addFeature );
19191919
connect( mActionCircularStringCurvePoint, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mCircularStringCurvePoint ); } );
19201920
connect( mActionCircularStringRadius, &QAction::triggered, this, [ = ] { setMapTool( mMapTools.mCircularStringRadius ); } );
@@ -8603,7 +8603,6 @@ void QgisApp::pasteLayer()
86038603

86048604
if ( !loaded )
86058605
{
8606-
QgsDebugMsg( errorMessage );
86078606
messageBar()->pushMessage( tr( "Error pasting layer" ), errorMessage, Qgis::Warning );
86088607
}
86098608
}

src/app/qgsapplayertreeviewmenuprovider.cpp

+13-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,15 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
5656
{
5757
// global menu
5858
menu->addAction( actions->actionAddGroup( menu ) );
59-
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionEditPaste.svg" ) ),
60-
tr( "Paste Layer/Group" ), QgisApp::instance(), SLOT( pasteLayer() ) );
61-
6259
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionExpandTree.svg" ) ), tr( "&Expand All" ), mView, SLOT( expandAll() ) );
6360
menu->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionCollapseTree.svg" ) ), tr( "&Collapse All" ), mView, SLOT( collapseAll() ) );
61+
menu->addSeparator();
62+
if ( QgisApp::instance()->clipboard()->hasFormat( QGSCLIPBOARD_MAPLAYER_MIME ) )
63+
{
64+
QAction *actionPasteLayerOrGroup = new QAction( QgsApplication::getThemeIcon( QStringLiteral( "/mActionEditPaste.svg" ) ), tr( "Paste Layer/Group" ), menu );
65+
connect( actionPasteLayerOrGroup, &QAction::triggered, QgisApp::instance(), &QgisApp::pasteLayer );
66+
menu->addAction( actionPasteLayerOrGroup );
67+
}
6468

6569
// TODO: update drawing order
6670
}
@@ -97,7 +101,9 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
97101
menu->addAction( tr( "Copy Group" ), QgisApp::instance(), SLOT( copyLayer() ) );
98102
if ( QgisApp::instance()->clipboard()->hasFormat( QGSCLIPBOARD_MAPLAYER_MIME ) )
99103
{
100-
menu->addAction( tr( "Paste Layer/Group" ), QgisApp::instance(), SLOT( pasteLayer() ) );
104+
QAction *actionPasteLayerOrGroup = new QAction( tr( "Paste Layer/Group" ), menu );
105+
connect( actionPasteLayerOrGroup, &QAction::triggered, QgisApp::instance(), &QgisApp::pasteLayer );
106+
menu->addAction( actionPasteLayerOrGroup );
101107
}
102108

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

217223
menu->addSeparator();
218-
menu->addAction( tr( "Copy Layer" ), QgisApp::instance(), SLOT( copyLayer() ) );
224+
QAction *actionCopyLayer = new QAction( tr( "Copy Layer" ), menu );
225+
connect( actionCopyLayer, &QAction::triggered, QgisApp::instance(), &QgisApp::copyLayer );
226+
menu->addAction( actionCopyLayer );
219227

220228
if ( vlayer )
221229
{

src/ui/qgisapp.ui

+4-1
Original file line numberDiff line numberDiff line change
@@ -3001,7 +3001,10 @@ Acts on currently active editable layer</string>
30013001
<normaloff>:/images/themes/default/mActionEditPaste.svg</normaloff>:/images/themes/default/mActionEditPaste.svg</iconset>
30023002
</property>
30033003
<property name="text">
3004-
<string>Paste Layer</string>
3004+
<string>Paste Layer/Group</string>
3005+
</property>
3006+
<property name="toolTip">
3007+
<string>Paste Layer/Group</string>
30053008
</property>
30063009
</action>
30073010
</widget>

0 commit comments

Comments
 (0)