mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
[gui] Do not add the "Save As…" action for unsupported layer types
as suggested during the PR review
This commit is contained in:
parent
6fc3ba3433
commit
9cb72d02ae
@ -670,13 +670,11 @@ QMenu *QgsAppLayerTreeViewMenuProvider::createContextMenu()
|
||||
{
|
||||
QMenu *menuExportRaster = new QMenu( tr( "E&xport" ), menu );
|
||||
menuExportRaster->setObjectName( QStringLiteral( "exportMenu" ) );
|
||||
if ( mView->selectedLayerNodes().count() == 1 )
|
||||
if ( mView->selectedLayerNodes().count() == 1 && ( ( pcLayer && pcLayer->isValid() && pcLayer->dataProvider()->hasValidIndex() ) || ( rlayer && rlayer->isValid() ) ) )
|
||||
{
|
||||
QAction *actionSaveAs = new QAction( tr( "Save &As…" ), menuExportRaster );
|
||||
connect( actionSaveAs, &QAction::triggered, QgisApp::instance(), [] { QgisApp::instance()->saveAsFile(); } );
|
||||
menuExportRaster->addAction( actionSaveAs );
|
||||
const bool enableSaveAs = ( pcLayer && pcLayer->isValid() && pcLayer->dataProvider()->hasValidIndex() ) || ( rlayer && rlayer->isValid() );
|
||||
actionSaveAs->setEnabled( enableSaveAs );
|
||||
}
|
||||
QAction *actionSaveAsDefinitionLayer = new QAction( tr( "Save as Layer &Definition File…" ), menuExportRaster );
|
||||
QAction *actionSaveStyle = new QAction( tr( "Save as &QGIS Layer Style File…" ), menuExportRaster );
|
||||
|
Loading…
x
Reference in New Issue
Block a user