Skip to content

Commit

Permalink
use handledFeatures as context in join buffer functions as well to av…
Browse files Browse the repository at this point in the history
…oid recursions and use it for feedback
  • Loading branch information
signedav committed May 7, 2020
1 parent 023f16f commit c4154b1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions python/core/auto_generated/qgsvectorlayerjoinbuffer.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
8 changes: 4 additions & 4 deletions src/core/qgsvectorlayerjoinbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 );
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsvectorlayerjoinbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:

Expand Down

0 comments on commit c4154b1

Please sign in to comment.