Skip to content

Commit

Permalink
Set object name for layer right click Export menu so that plugins
Browse files Browse the repository at this point in the history
can easily find this submenu to add extra entries to it
  • Loading branch information
nyalldawson committed Mar 16, 2023
1 parent 7e7b3a0 commit 70f98cc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/qgsapplayertreeviewmenuprovider.cpp
Expand Up @@ -143,6 +143,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
menu->addSeparator();

QMenu *menuExportGroup = new QMenu( tr( "E&xport" ), menu );
menuExportGroup->setObjectName( QStringLiteral( "exportMenu" ) );
QAction *actionSaveAsDefinitionGroup = new QAction( tr( "Save as Layer &Definition File…" ), menuExportGroup );
connect( actionSaveAsDefinitionGroup, &QAction::triggered, QgisApp::instance(), &QgisApp::saveAsLayerDefinition );
menuExportGroup->addAction( actionSaveAsDefinitionGroup );
Expand Down Expand Up @@ -539,6 +540,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
}
// save as vector file
QMenu *menuExportVector = new QMenu( tr( "E&xport" ), menu );
menuExportVector->setObjectName( QStringLiteral( "exportMenu" ) );
QAction *actionSaveAs = new QAction( tr( "Save Features &As…" ), menuExportVector );
connect( actionSaveAs, &QAction::triggered, QgisApp::instance(), [ = ] { QgisApp::instance()->saveAsFile(); } );
actionSaveAs->setEnabled( vlayer->isValid() );
Expand Down Expand Up @@ -568,6 +570,7 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
bool enableSaveAs = ( pcLayer && pcLayer->isValid() ) ||
( rlayer && rlayer->isValid() );
QMenu *menuExportRaster = new QMenu( tr( "E&xport" ), menu );
menuExportRaster->setObjectName( QStringLiteral( "exportMenu" ) );
QAction *actionSaveAs = new QAction( tr( "Save &As…" ), menuExportRaster );
QAction *actionSaveAsDefinitionLayer = new QAction( tr( "Save as Layer &Definition File…" ), menuExportRaster );
QAction *actionSaveStyle = new QAction( tr( "Save as &QGIS Layer Style File…" ), menuExportRaster );
Expand Down

0 comments on commit 70f98cc

Please sign in to comment.