Skip to content
Permalink
Browse files

raise message and return if trying to paste or cut features on not ed…

…itable layer
  • Loading branch information
signedav committed Jul 8, 2020
1 parent e8c080a commit ee660f7006944f9b08b78616ccf94cdc38bb398c
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/app/qgisapp.cpp
@@ -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" ) );
@@ -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();

0 comments on commit ee660f7

Please sign in to comment.
You can’t perform that action at this time.