QGIS API Documentation
3.0.2-Girona (307d082)
|
#include <qgsvectorlayereditpassthrough.h>
Public Member Functions | |
QgsVectorLayerEditPassthrough (QgsVectorLayer *layer) | |
bool | addAttribute (const QgsField &field) override |
Add an attribute field (but does not commit it) returns true if the field was added. More... | |
bool | addFeature (QgsFeature &f) override |
Adds a feature. More... | |
bool | addFeatures (QgsFeatureList &features) override |
Insert a copy of the given features into the layer (but does not commit it) More... | |
bool | changeAttributeValue (QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue=QVariant()) override |
Changed an attribute value (but does not commit it) More... | |
bool | changeAttributeValues (QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues) override |
Changes values of attributes (but does not commit it). More... | |
bool | changeGeometry (QgsFeatureId fid, const QgsGeometry &geom) override |
Change feature's geometry. More... | |
bool | commitChanges (QStringList &commitErrors) override |
Attempts to commit any changes to disk. More... | |
bool | deleteAttribute (int attr) override |
Delete an attribute field (but does not commit it) More... | |
bool | deleteFeature (QgsFeatureId fid) override |
Delete a feature from the layer (but does not commit it) More... | |
bool | deleteFeatures (const QgsFeatureIds &fids) override |
Deletes a set of features from the layer (but does not commit it) More... | |
bool | isModified () const override |
Returns true if the provider has been modified since the last commit. More... | |
bool | renameAttribute (int attr, const QString &newName) override |
Renames an attribute field (but does not commit it) More... | |
void | rollBack () override |
Stop editing and discard the edits. More... | |
bool | update (QgsTransaction *transaction, const QString &sql, const QString &name) |
Update underlying data with a SQL query embedded in a transaction. More... | |
Public Member Functions inherited from QgsVectorLayerEditBuffer | |
QgsVectorLayerEditBuffer (QgsVectorLayer *layer) | |
QList< QgsField > | addedAttributes () const |
Returns a list of added attributes fields which are not committed. More... | |
QgsFeatureMap | addedFeatures () const |
Returns a map of new features which are not committed. More... | |
QgsChangedAttributesMap | changedAttributeValues () const |
Returns a map of features with changed attributes values which are not committed. More... | |
QgsGeometryMap | changedGeometries () const |
Returns a map of features with changed geometries which are not committed. More... | |
QgsAttributeList | deletedAttributeIds () const |
Returns a list of deleted attributes fields which are not committed. More... | |
QgsFeatureIds | deletedFeatureIds () const |
Returns a list of deleted feature IDs which are not committed. More... | |
bool | isAttributeDeleted (int index) const |
Returns true if the specified attribute has been deleted but not committed. More... | |
bool | isFeatureAdded (QgsFeatureId id) const |
Returns true if the specified feature ID has been added but not committed. More... | |
bool | isFeatureAttributesChanged (QgsFeatureId id) const |
Returns true if the specified feature ID has had an attribute changed but not committed. More... | |
bool | isFeatureDeleted (QgsFeatureId id) const |
Returns true if the specified feature ID has been deleted but not committed. More... | |
bool | isFeatureGeometryChanged (QgsFeatureId id) const |
Returns true if the specified feature ID has had its geometry changed but not committed. More... | |
Additional Inherited Members | |
Signals inherited from QgsVectorLayerEditBuffer | |
void | attributeAdded (int idx) |
void | attributeDeleted (int idx) |
void | attributeRenamed (int idx, const QString &newName) |
Emitted when an attribute has been renamed. More... | |
void | attributeValueChanged (QgsFeatureId fid, int idx, const QVariant &) |
void | committedAttributesAdded (const QString &layerId, const QList< QgsField > &addedAttributes) |
void | committedAttributesDeleted (const QString &layerId, const QgsAttributeList &deletedAttributes) |
Signals emitted after committing changes. More... | |
void | committedAttributesRenamed (const QString &layerId, const QgsFieldNameMap &renamedAttributes) |
Emitted after committing an attribute rename. More... | |
void | committedAttributeValuesChanges (const QString &layerId, const QgsChangedAttributesMap &changedAttributesValues) |
void | committedFeaturesAdded (const QString &layerId, const QgsFeatureList &addedFeatures) |
void | committedFeaturesRemoved (const QString &layerId, const QgsFeatureIds &deletedFeatureIds) |
void | committedGeometriesChanges (const QString &layerId, const QgsGeometryMap &changedGeometries) |
void | featureAdded (QgsFeatureId fid) |
void | featureDeleted (QgsFeatureId fid) |
void | geometryChanged (QgsFeatureId fid, const QgsGeometry &geom) |
Emitted when a feature's geometry is changed. More... | |
void | layerModified () |
This signal is emitted when modifications has been done on layer. More... | |
Protected Slots inherited from QgsVectorLayerEditBuffer | |
void | undoIndexChanged (int index) |
Protected Member Functions inherited from QgsVectorLayerEditBuffer | |
QgsVectorLayerEditBuffer ()=default | |
Constructor for QgsVectorLayerEditBuffer. More... | |
void | handleAttributeAdded (int index) |
Update added and changed features after addition of an attribute. More... | |
void | handleAttributeDeleted (int index) |
Update added and changed features after removal of an attribute. More... | |
void | updateAttributeMapIndex (QgsAttributeMap &attrs, int index, int offset) const |
Updates an index in an attribute map to a new value (for updates of changed attributes) More... | |
void | updateChangedAttributes (QgsFeature &f) |
Update feature with uncommitted attribute updates. More... | |
void | updateFeatureGeometry (QgsFeature &f) |
Update feature with uncommitted geometry updates. More... | |
void | updateFields (QgsFields &fields) |
void | updateLayerFields () |
Protected Attributes inherited from QgsVectorLayerEditBuffer | |
QgsVectorLayer * | L = nullptr |
QList< QgsField > | mAddedAttributes |
Added attributes fields which are not committed. More... | |
QgsFeatureMap | mAddedFeatures |
New features which are not committed. More... | |
QgsChangedAttributesMap | mChangedAttributeValues |
Changed attributes values which are not committed. More... | |
QgsGeometryMap | mChangedGeometries |
Changed geometries which are not committed. More... | |
QgsAttributeList | mDeletedAttributeIds |
Deleted attributes fields which are not committed. The list is kept sorted. More... | |
QgsFeatureIds | mDeletedFeatureIds |
Deleted feature IDs which are not committed. More... | |
QgsFieldNameMap | mRenamedAttributes |
Renamed attributes which are not committed. More... | |
Definition at line 29 of file qgsvectorlayereditpassthrough.h.
QgsVectorLayerEditPassthrough::QgsVectorLayerEditPassthrough | ( | QgsVectorLayer * | layer | ) |
Definition at line 22 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Add an attribute field (but does not commit it) returns true if the field was added.
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 94 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Adds a feature.
f | feature to add |
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 48 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Insert a copy of the given features into the layer (but does not commit it)
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 59 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Changed an attribute value (but does not commit it)
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 84 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Changes values of attributes (but does not commit it).
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 89 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Change feature's geometry.
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 79 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Attempts to commit any changes to disk.
Returns the result of the attempt. If a commit fails, the in-memory changes are left alone.
This allows editing to continue if the commit failed on e.g. a disallowed value in a Postgres database - the user can re-edit and try again.
The commits occur in distinct stages, (add attributes, add features, change attribute values, change geometries, delete features, delete attributes) so if a stage fails, it's difficult to roll back cleanly. Therefore any error message also includes which stage failed so that the user has some chance of repairing the damage cleanly.
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 109 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Delete an attribute field (but does not commit it)
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 99 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Delete a feature from the layer (but does not commit it)
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 69 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Deletes a set of features from the layer (but does not commit it)
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 74 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Returns true if the provider has been modified since the last commit.
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 28 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Renames an attribute field (but does not commit it)
attr | attribute index |
newName | new name of field |
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 104 of file qgsvectorlayereditpassthrough.cpp.
|
overridevirtual |
Stop editing and discard the edits.
Reimplemented from QgsVectorLayerEditBuffer.
Definition at line 115 of file qgsvectorlayereditpassthrough.cpp.
bool QgsVectorLayerEditPassthrough::update | ( | QgsTransaction * | transaction, |
const QString & | sql, | ||
const QString & | name | ||
) |
Update underlying data with a SQL query embedded in a transaction.
transaction | Transaction in which the sql query has been run |
sql | The SQL query updating data |
name | The name of the undo/redo command |
Definition at line 120 of file qgsvectorlayereditpassthrough.cpp.