#include <qgsvectorlayereditbuffer.h>
Constructor & Destructor Documentation
QgsVectorLayerEditBuffer::QgsVectorLayerEditBuffer |
( |
QgsVectorLayer * |
layer | ) |
|
QgsVectorLayerEditBuffer::~QgsVectorLayerEditBuffer |
( |
| ) |
|
Member Function Documentation
bool QgsVectorLayerEditBuffer::addAttribute |
( |
const QgsField & |
field | ) |
|
add an attribute field (but does not commit it) returns true if the field was added
const QList<QgsField>& QgsVectorLayerEditBuffer::addedAttributes |
( |
| ) |
|
|
inline |
added attributes fields which are not commited
New features which are not commited.
bool QgsVectorLayerEditBuffer::addFeature |
( |
QgsFeature & |
f | ) |
|
Adds a feature.
- Parameters
-
- Returns
- True in case of success and False in case of error
bool QgsVectorLayerEditBuffer::addFeatures |
( |
QgsFeatureList & |
features | ) |
|
Insert a copy of the given features into the layer (but does not commit it)
void QgsVectorLayerEditBuffer::attributeAdded |
( |
int |
idx | ) |
|
|
signal |
void QgsVectorLayerEditBuffer::attributeDeleted |
( |
int |
idx | ) |
|
|
signal |
void QgsVectorLayerEditBuffer::attributeValueChanged |
( |
QgsFeatureId |
fid, |
|
|
int |
idx, |
|
|
const QVariant & |
|
|
) |
| |
|
signal |
bool QgsVectorLayerEditBuffer::changeAttributeValue |
( |
QgsFeatureId |
fid, |
|
|
int |
field, |
|
|
const QVariant & |
newValue, |
|
|
const QVariant & |
oldValue = QVariant() |
|
) |
| |
changed an attribute value (but does not commit it)
Changed attributes values which are not commited.
Changed geometries which are not commited.
change feature's geometry
bool QgsVectorLayerEditBuffer::commitChanges |
( |
QStringList & |
commitErrors | ) |
|
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.
void QgsVectorLayerEditBuffer::committedAttributesAdded |
( |
const QString & |
layerId, |
|
|
const QList< QgsField > & |
addedAttributes |
|
) |
| |
|
signal |
void QgsVectorLayerEditBuffer::committedAttributesDeleted |
( |
const QString & |
layerId, |
|
|
const QgsAttributeList & |
deletedAttributes |
|
) |
| |
|
signal |
Signals emitted after committing changes.
void QgsVectorLayerEditBuffer::committedAttributeValuesChanges |
( |
const QString & |
layerId, |
|
|
const QgsChangedAttributesMap & |
changedAttributesValues |
|
) |
| |
|
signal |
void QgsVectorLayerEditBuffer::committedFeaturesAdded |
( |
const QString & |
layerId, |
|
|
const QgsFeatureList & |
addedFeatures |
|
) |
| |
|
signal |
void QgsVectorLayerEditBuffer::committedFeaturesRemoved |
( |
const QString & |
layerId, |
|
|
const QgsFeatureIds & |
deletedFeatureIds |
|
) |
| |
|
signal |
void QgsVectorLayerEditBuffer::committedGeometriesChanges |
( |
const QString & |
layerId, |
|
|
const QgsGeometryMap & |
changedGeometries |
|
) |
| |
|
signal |
bool QgsVectorLayerEditBuffer::deleteAttribute |
( |
int |
attr | ) |
|
delete an attribute field (but does not commit it)
deleted attributes fields which are not commited.
The list is kept sorted.
const QgsFeatureIds QgsVectorLayerEditBuffer::deletedFeatureIds |
( |
| ) |
|
|
inline |
bool QgsVectorLayerEditBuffer::deleteFeature |
( |
QgsFeatureId |
fid | ) |
|
delete a feature from the layer (but does not commit it)
void QgsVectorLayerEditBuffer::featureAdded |
( |
QgsFeatureId |
fid | ) |
|
|
signal |
void QgsVectorLayerEditBuffer::featureDeleted |
( |
QgsFeatureId |
fid | ) |
|
|
signal |
void QgsVectorLayerEditBuffer::handleAttributeAdded |
( |
int |
index | ) |
|
|
protected |
update added and changed features after addition of an attribute
void QgsVectorLayerEditBuffer::handleAttributeDeleted |
( |
int |
index | ) |
|
|
protected |
update added and changed features after removal of an attribute
bool QgsVectorLayerEditBuffer::isModified |
( |
| ) |
const |
Returns true if the provider has been modified since the last commit.
void QgsVectorLayerEditBuffer::layerModified |
( |
| ) |
|
|
signal |
This signal is emitted when modifications has been done on layer.
void QgsVectorLayerEditBuffer::rollBack |
( |
| ) |
|
Stop editing and discard the edits.
void QgsVectorLayerEditBuffer::undoIndexChanged |
( |
int |
index | ) |
|
|
protectedslot |
void QgsVectorLayerEditBuffer::updateAttributeMapIndex |
( |
QgsAttributeMap & |
attrs, |
|
|
int |
index, |
|
|
int |
offset |
|
) |
| const |
|
protected |
Updates an index in an attribute map to a new value (for updates of changed attributes)
void QgsVectorLayerEditBuffer::updateChangedAttributes |
( |
QgsFeature & |
f | ) |
|
|
protected |
Update feature with uncommited attribute updates.
void QgsVectorLayerEditBuffer::updateFeatureGeometry |
( |
QgsFeature & |
f | ) |
|
|
protected |
Update feature with uncommited geometry updates.
void QgsVectorLayerEditBuffer::updateFields |
( |
QgsFields & |
fields | ) |
|
|
protected |
void QgsVectorLayerEditBuffer::updateLayerFields |
( |
| ) |
|
|
protected |
Friends And Related Function Documentation
Member Data Documentation
QList<QgsField> QgsVectorLayerEditBuffer::mAddedAttributes |
|
protected |
added attributes fields which are not commited
New features which are not commited.
Changed attributes values which are not commited.
Changed geometries which are not commited.
deleted attributes fields which are not commited.
The list is kept sorted.
Deleted feature IDs which are not commited.
Note a feature can be added and then deleted again before the change is committed - in that case the added feature would be removed from mAddedFeatures only and not entered here.
The documentation for this class was generated from the following files: