Skip to content
Permalink
Browse files

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

…itable layer

(cherry-pick from 40264ce)
  • Loading branch information
signedav committed Jul 8, 2020
1 parent 40264ce commit 5b01c54023be6b1497f11ca444a9bfa90d0b519a
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/app/qgisapp.cpp
@@ -10081,6 +10081,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" ) );
@@ -10109,6 +10117,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 5b01c54

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