Skip to content
Permalink
Browse files

Use the newly added QgsVectorLayer::supportsEditing

  • Loading branch information
suricactus authored and nyalldawson committed Dec 21, 2020
1 parent a05971d commit 3a865ad9a3c3bafb25ce09fdd1eb0ca8d7b2f42a
Showing with 3 additions and 8 deletions.
  1. +1 −1 src/app/qgisapp.cpp
  2. +1 −1 src/app/qgsguivectorlayertools.cpp
  3. +1 −6 src/core/qgsvectorlayer.cpp
@@ -11082,7 +11082,7 @@ bool QgisApp::toggleEditing( QgsMapLayer *layer, bool allowCancel )

if ( !vlayer->isEditable() && !vlayer->readOnly() )
{
if ( !( vlayer->dataProvider()->capabilities() & QgsVectorDataProvider::EditingCapabilities ) )
if ( !vlayer->supportsEditing() )
{
mActionToggleEditing->setChecked( false );
mActionToggleEditing->setEnabled( false );
@@ -56,7 +56,7 @@ bool QgsGuiVectorLayerTools::startEditing( QgsVectorLayer *layer ) const

if ( !layer->isEditable() && !layer->readOnly() )
{
if ( !( layer->dataProvider()->capabilities() & QgsVectorDataProvider::EditingCapabilities ) )
if ( !layer->supportsEditing() )
{
QgisApp::instance()->messageBar()->pushMessage( tr( "Start editing failed" ),
tr( "Provider cannot be opened for editing" ),
@@ -1434,12 +1434,7 @@ bool QgsVectorLayer::startEditing()
}

// allow editing if provider supports any of the capabilities
if ( !( mDataProvider->capabilities() & QgsVectorDataProvider::EditingCapabilities ) )
{
return false;
}

if ( mReadOnly )
if ( supportsEditing() )
{
return false;
}

0 comments on commit 3a865ad

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