Skip to content

Commit

Permalink
raise message and return if trying to paste or cut features on not ed…
Browse files Browse the repository at this point in the history
…itable layer
  • Loading branch information
signedav committed Jul 8, 2020
1 parent e8c080a commit ee660f7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -10100,6 +10100,14 @@ void QgisApp::cutSelectionToClipboard( QgsMapLayer *layerContainingSelection )
if ( !selectionVectorLayer )
return;

if ( !selectionVectorLayer->isEditable() )
{
visibleMessageBar()->pushMessage( tr( "Layer not editable" ),
tr( "The current layer is not editable. Choose 'Start editing' in the digitizing toolbar." ),
Qgis::Info, messageTimeout() );
return;
}

clipboard()->replaceWithCopyOf( selectionVectorLayer );

selectionVectorLayer->beginEditCommand( tr( "Features cut" ) );
Expand Down Expand Up @@ -10128,6 +10136,14 @@ void QgisApp::pasteFromClipboard( QgsMapLayer *destinationLayer )
if ( !pasteVectorLayer )
return;

if ( !pasteVectorLayer->isEditable() )
{
visibleMessageBar()->pushMessage( tr( "Layer not editable" ),
tr( "The current layer is not editable. Choose 'Start editing' in the digitizing toolbar." ),
Qgis::Info, messageTimeout() );
return;
}

pasteVectorLayer->beginEditCommand( tr( "Features pasted" ) );
QgsFeatureList features = clipboard()->transformedCopyOf( pasteVectorLayer->crs(), pasteVectorLayer->fields() );
int nTotalFeatures = features.count();
Expand Down

0 comments on commit ee660f7

Please sign in to comment.