Skip to content
Permalink
Browse files

use handledFeatures as context in join buffer functions as well to av…

…oid recursions and use it for feedback
  • Loading branch information
signedav committed May 7, 2020
1 parent 023f16f commit c4154b1ca52455f5e8352d2dadac7c0c02722464
@@ -207,7 +207,7 @@ created if its fields are not empty.
.. versionadded:: 3.0
%End

bool deleteFeature( QgsFeatureId fid, const bool cascade = false ) const;
bool deleteFeature( QgsFeatureId fid, const bool cascade = false, QMap<QgsVectorLayer *, QgsFeatureIds> *handledFeatures = 0 ) const;
%Docstring
Deletes a feature from joined layers. The feature id given in
parameter is the one coming from the target layer.
@@ -220,7 +220,7 @@ parameter is the one coming from the target layer.
.. versionadded:: 3.0
%End

bool deleteFeatures( const QgsFeatureIds &fids, const bool cascade = false ) const;
bool deleteFeatures( const QgsFeatureIds &fids, const bool cascade = false, QMap<QgsVectorLayer *, QgsFeatureIds> *handledFeatures = 0 ) const;
%Docstring
Deletes a list of features from joined layers. Feature ids given
in a parameter are those coming from the target layer.
@@ -3215,7 +3215,7 @@ bool QgsVectorLayer::deleteFeatureCascade( QgsFeatureId fid, const bool cascade,
}

if ( mJoinBuffer->containsJoins() )
mJoinBuffer->deleteFeature( fid, cascade );
mJoinBuffer->deleteFeature( fid, cascade, handledFeatures );

bool res = mEditBuffer->deleteFeature( fid );

@@ -663,12 +663,12 @@ bool QgsVectorLayerJoinBuffer::changeAttributeValues( QgsFeatureId fid, const Qg
return success;
}

bool QgsVectorLayerJoinBuffer::deleteFeature( QgsFeatureId fid, const bool cascade ) const
bool QgsVectorLayerJoinBuffer::deleteFeature( QgsFeatureId fid, const bool cascade, QMap<QgsVectorLayer *, QgsFeatureIds> *handledFeatures ) const
{
return deleteFeatures( QgsFeatureIds() << fid, cascade );
return deleteFeatures( QgsFeatureIds() << fid, cascade, handledFeatures );
}

bool QgsVectorLayerJoinBuffer::deleteFeatures( const QgsFeatureIds &fids, const bool cascade ) const
bool QgsVectorLayerJoinBuffer::deleteFeatures( const QgsFeatureIds &fids, const bool cascade, QMap<QgsVectorLayer *, QgsFeatureIds> *handledFeatures ) const
{
if ( !containsJoins() )
return false;
@@ -683,7 +683,7 @@ bool QgsVectorLayerJoinBuffer::deleteFeatures( const QgsFeatureIds &fids, const
{
const QgsFeature joinFeature = joinedFeatureOf( &info, mLayer->getFeature( fid ) );
if ( joinFeature.isValid() )
info.joinLayer()->deleteFeature( joinFeature.id(), cascade );
info.joinLayer()->deleteFeature( joinFeature.id(), cascade, handledFeatures );
}
}
}
@@ -202,7 +202,7 @@ class CORE_EXPORT QgsVectorLayerJoinBuffer : public QObject, public QgsFeatureSi
*
* \since QGIS 3.0
*/
bool deleteFeature( QgsFeatureId fid, const bool cascade = false ) const;
bool deleteFeature( QgsFeatureId fid, const bool cascade = false, QMap<QgsVectorLayer *, QgsFeatureIds> *handledFeatures = nullptr ) const;

/**
* Deletes a list of features from joined layers. Feature ids given
@@ -214,7 +214,7 @@ class CORE_EXPORT QgsVectorLayerJoinBuffer : public QObject, public QgsFeatureSi
*
* \since QGIS 3.0
*/
bool deleteFeatures( const QgsFeatureIds &fids, const bool cascade = false ) const;
bool deleteFeatures( const QgsFeatureIds &fids, const bool cascade = false, QMap<QgsVectorLayer *, QgsFeatureIds> *handledFeatures = nullptr ) const;

signals:

0 comments on commit c4154b1

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