@@ -56,11 +56,15 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
56
56
{
57
57
// global menu
58
58
menu->addAction ( actions->actionAddGroup ( menu ) );
59
- menu->addAction ( QgsApplication::getThemeIcon ( QStringLiteral ( " /mActionEditPaste.svg" ) ),
60
- tr ( " Paste Layer/Group" ), QgisApp::instance (), SLOT ( pasteLayer () ) );
61
-
62
59
menu->addAction ( QgsApplication::getThemeIcon ( QStringLiteral ( " /mActionExpandTree.svg" ) ), tr ( " &Expand All" ), mView , SLOT ( expandAll () ) );
63
60
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
+ }
64
68
65
69
// TODO: update drawing order
66
70
}
@@ -97,7 +101,9 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
97
101
menu->addAction ( tr ( " Copy Group" ), QgisApp::instance (), SLOT ( copyLayer () ) );
98
102
if ( QgisApp::instance ()->clipboard ()->hasFormat ( QGSCLIPBOARD_MAPLAYER_MIME ) )
99
103
{
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 );
101
107
}
102
108
103
109
menu->addAction ( tr ( " Save As Layer Definition File…" ), QgisApp::instance (), SLOT ( saveAsLayerDefinition () ) );
@@ -215,7 +221,9 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
215
221
}
216
222
217
223
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 );
219
227
220
228
if ( vlayer )
221
229
{
0 commit comments