Skip to content
Permalink
Browse files

getter for handledFeatures in DeleteContext

  • Loading branch information
signedav committed May 11, 2020
1 parent 3c963ab commit d6a038b700ec7ddf95732b5f5139a21faa6ab5ef
Showing with 18 additions and 9 deletions.
  1. +6 −2 python/core/auto_generated/qgsvectorlayer.sip.in
  2. +4 −4 src/core/qgsvectorlayer.cpp
  3. +8 −3 src/core/qgsvectorlayer.h
@@ -374,15 +374,19 @@ Constructor for LayerOptions.

};

struct DeleteContext
struct DeleteContext
{

explicit DeleteContext( bool cascade = false );
%Docstring
Constructor for DeleteContext.
%End

QMap<QgsVectorLayer *, QgsFeatureIds> handledFeatures;
QMap<QgsVectorLayer *, QgsFeatureIds> handledFeatures();
%Docstring
Returns all the layers on which features have been deleted
%End

bool cascade;
};

@@ -3171,9 +3171,9 @@ bool QgsVectorLayer::deleteFeatureCascade( QgsFeatureId fid, QgsVectorLayer::Del

if ( context && context->cascade )
{
if ( context->handledFeatures.contains( this ) )
if ( context->mHandledFeatures.contains( this ) )
{
QgsFeatureIds handledFeatureIds = context->handledFeatures.value( this );
QgsFeatureIds handledFeatureIds = context->mHandledFeatures.value( this );
if ( handledFeatureIds.contains( fid ) )
{
// avoid endless recursion
@@ -3183,13 +3183,13 @@ bool QgsVectorLayer::deleteFeatureCascade( QgsFeatureId fid, QgsVectorLayer::Del
{
// add feature id
handledFeatureIds << fid;
context->handledFeatures.insert( this, handledFeatureIds );
context->mHandledFeatures.insert( this, handledFeatureIds );
}
}
else
{
// add layer and feature id
context->handledFeatures.insert( this, QgsFeatureIds() << fid );
context->mHandledFeatures.insert( this, QgsFeatureIds() << fid );
}

const QList<QgsRelation> relations = QgsProject::instance()->relationManager()->referencedRelations( this );
@@ -508,16 +508,21 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
* Context for deleting features
* \since QGIS 3.14
*/
struct DeleteContext
struct DeleteContext
{

/**
* Constructor for DeleteContext.
*/
explicit DeleteContext( bool cascade = false ): cascade( cascade ) {}

QMap<QgsVectorLayer *, QgsFeatureIds> handledFeatures;
bool cascade ;
/**
* Returns all the layers on which features have been deleted
*/
QMap<QgsVectorLayer *, QgsFeatureIds> handledFeatures() { return mHandledFeatures; }

QMap<QgsVectorLayer *, QgsFeatureIds> mHandledFeatures SIP_SKIP;
bool cascade;
};

/**

0 comments on commit d6a038b

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