Skip to content

Commit

Permalink
Fix misleading docs that is only valid if edit buffer is used (so doe…
Browse files Browse the repository at this point in the history
…s not work in transaction mode)

Long story short, the `layer.committedFeaturesAdded` signal is not fired after `layer.commitChanges()` when in transaction mode.

If the layer is using the `QgsVectorLayerEditBuffer` the `commitedFeaturesAdded` signal is fired.
But if transaction is used and the `layer.editBuffer()` returns `QgsVectorLayerEditPasstrough`, then there is no signal.

The `QgsVectorLayerEditPasstrough` class is quite empty and lacking implementation of these events, so they don't work on layers in a transaction group.
  • Loading branch information
suricactus committed Dec 14, 2021
1 parent 7b5cd9b commit 527359b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions python/core/auto_generated/vector/qgsvectorlayer.sip.in
Expand Up @@ -2891,27 +2891,27 @@ Note that at this point the geometry change is not yet saved to the provider.

void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
%Docstring
Emitted when attributes are deleted from the provider
Emitted when attributes are deleted from the provider if not in transaction mode.
%End
void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
%Docstring
Emitted when attributes are added to the provider
Emitted when attributes are added to the provider if not in transaction mode.
%End
void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
%Docstring
Emitted when features are added to the provider
Emitted when features are added to the provider if not in transaction mode.
%End
void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
%Docstring
Emitted when features are deleted from the provider
Emitted when features are deleted from the provider if not in transaction mode.
%End
void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
%Docstring
Emitted when attribute value changes are saved to the provider
Emitted when attribute value changes are saved to the provider if not in transaction mode.
%End
void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );
%Docstring
Emitted when geometry changes are saved to the provider
Emitted when geometry changes are saved to the provider if not in transaction mode.
%End

void labelingFontNotFound( QgsVectorLayer *layer, const QString &fontfamily );
Expand Down
12 changes: 6 additions & 6 deletions src/core/vector/qgsvectorlayer.h
Expand Up @@ -2680,17 +2680,17 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
*/
void geometryChanged( QgsFeatureId fid, const QgsGeometry &geometry );

//! Emitted when attributes are deleted from the provider
//! Emitted when attributes are deleted from the provider if not in transaction mode.
void committedAttributesDeleted( const QString &layerId, const QgsAttributeList &deletedAttributes );
//! Emitted when attributes are added to the provider
//! Emitted when attributes are added to the provider if not in transaction mode.
void committedAttributesAdded( const QString &layerId, const QList<QgsField> &addedAttributes );
//! Emitted when features are added to the provider
//! Emitted when features are added to the provider if not in transaction mode.
void committedFeaturesAdded( const QString &layerId, const QgsFeatureList &addedFeatures );
//! Emitted when features are deleted from the provider
//! Emitted when features are deleted from the provider if not in transaction mode.
void committedFeaturesRemoved( const QString &layerId, const QgsFeatureIds &deletedFeatureIds );
//! Emitted when attribute value changes are saved to the provider
//! Emitted when attribute value changes are saved to the provider if not in transaction mode.
void committedAttributeValuesChanges( const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues );
//! Emitted when geometry changes are saved to the provider
//! Emitted when geometry changes are saved to the provider if not in transaction mode.
void committedGeometriesChanges( const QString &layerId, const QgsGeometryMap &changedGeometries );

//! Emitted when the font family defined for labeling layer is not found on system
Expand Down

0 comments on commit 527359b

Please sign in to comment.