QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Public Member Functions | List of all members
QgsVectorLayerEditPassthrough Class Reference

#include <qgsvectorlayereditpassthrough.h>

Inheritance diagram for QgsVectorLayerEditPassthrough:
Inheritance graph
[legend]

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, 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...
 
- Public Member Functions inherited from QgsVectorLayerEditBuffer
 QgsVectorLayerEditBuffer (QgsVectorLayer *layer)
 
 ~QgsVectorLayerEditBuffer ()
 
const QList< QgsField > & addedAttributes ()
 Added attributes fields which are not commited. More...
 
const QgsFeatureMapaddedFeatures ()
 New features which are not commited. More...
 
const QgsChangedAttributesMapchangedAttributeValues ()
 Changed attributes values which are not commited. More...
 
const QgsGeometryMapchangedGeometries ()
 Changed geometries which are not commited. More...
 
const QgsAttributeListdeletedAttributeIds ()
 Deleted attributes fields which are not commited. More...
 
const QgsFeatureIds deletedFeatureIds ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

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, QgsGeometry &geom)
 
void layerModified ()
 This signal is emitted when modifications has been done on layer. More...
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Slots inherited from QgsVectorLayerEditBuffer
void undoIndexChanged (int index)
 
- Protected Member Functions inherited from QgsVectorLayerEditBuffer
 QgsVectorLayerEditBuffer ()
 
bool adaptGeometry (QgsGeometry *geometry)
 Apply geometry modification basing on provider geometry type. 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 uncommited attribute updates. More...
 
void updateFeatureGeometry (QgsFeature &f)
 Update feature with uncommited geometry updates. More...
 
void updateFields (QgsFields &fields)
 
void updateLayerFields ()
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Protected Attributes inherited from QgsVectorLayerEditBuffer
QgsVectorLayerL
 
QList< QgsFieldmAddedAttributes
 Added attributes fields which are not commited. More...
 
QgsFeatureMap mAddedFeatures
 New features which are not commited. More...
 
QgsChangedAttributesMap mChangedAttributeValues
 Changed attributes values which are not commited. More...
 
QgsGeometryMap mChangedGeometries
 Changed geometries which are not commited. More...
 
QgsAttributeList mDeletedAttributeIds
 Deleted attributes fields which are not commited. More...
 
QgsFeatureIds mDeletedFeatureIds
 Deleted feature IDs which are not commited. More...
 
QgsFieldNameMap mRenamedAttributes
 Renamed attributes which are not commited. More...
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Definition at line 25 of file qgsvectorlayereditpassthrough.h.

Constructor & Destructor Documentation

◆ QgsVectorLayerEditPassthrough()

QgsVectorLayerEditPassthrough::QgsVectorLayerEditPassthrough ( QgsVectorLayer layer)

Definition at line 20 of file qgsvectorlayereditpassthrough.cpp.

Member Function Documentation

◆ addAttribute()

bool QgsVectorLayerEditPassthrough::addAttribute ( const QgsField field)
overridevirtual

Add an attribute field (but does not commit it) returns true if the field was added.

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 133 of file qgsvectorlayereditpassthrough.cpp.

◆ addFeature()

bool QgsVectorLayerEditPassthrough::addFeature ( QgsFeature f)
overridevirtual

Adds a feature.

Parameters
ffeature to add
Returns
True in case of success and False in case of error

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 31 of file qgsvectorlayereditpassthrough.cpp.

◆ addFeatures()

bool QgsVectorLayerEditPassthrough::addFeatures ( QgsFeatureList features)
overridevirtual

Insert a copy of the given features into the layer (but does not commit it)

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 46 of file qgsvectorlayereditpassthrough.cpp.

◆ changeAttributeValue()

bool QgsVectorLayerEditPassthrough::changeAttributeValue ( QgsFeatureId  fid,
int  field,
const QVariant newValue,
const QVariant oldValue = QVariant() 
)
overridevirtual

Changed an attribute value (but does not commit it)

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 97 of file qgsvectorlayereditpassthrough.cpp.

◆ changeAttributeValues()

bool QgsVectorLayerEditPassthrough::changeAttributeValues ( QgsFeatureId  fid,
const QgsAttributeMap newValues,
const QgsAttributeMap oldValues 
)
overridevirtual

Changes values of attributes (but does not commit it).

Returns
true if attributes are well updated, false otherwise
Note
added in QGIS 2.18

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 112 of file qgsvectorlayereditpassthrough.cpp.

◆ changeGeometry()

bool QgsVectorLayerEditPassthrough::changeGeometry ( QgsFeatureId  fid,
QgsGeometry geom 
)
overridevirtual

Change feature's geometry.

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 84 of file qgsvectorlayereditpassthrough.cpp.

◆ commitChanges()

bool QgsVectorLayerEditPassthrough::commitChanges ( QStringList commitErrors)
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 170 of file qgsvectorlayereditpassthrough.cpp.

◆ deleteAttribute()

bool QgsVectorLayerEditPassthrough::deleteAttribute ( int  attr)
overridevirtual

Delete an attribute field (but does not commit it)

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 144 of file qgsvectorlayereditpassthrough.cpp.

◆ deleteFeature()

bool QgsVectorLayerEditPassthrough::deleteFeature ( QgsFeatureId  fid)
overridevirtual

Delete a feature from the layer (but does not commit it)

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 60 of file qgsvectorlayereditpassthrough.cpp.

◆ deleteFeatures()

bool QgsVectorLayerEditPassthrough::deleteFeatures ( const QgsFeatureIds fid)
overridevirtual

Deletes a set of features from the layer (but does not commit it)

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 71 of file qgsvectorlayereditpassthrough.cpp.

◆ isModified()

bool QgsVectorLayerEditPassthrough::isModified ( ) const
overridevirtual

Returns true if the provider has been modified since the last commit.

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 26 of file qgsvectorlayereditpassthrough.cpp.

◆ renameAttribute()

bool QgsVectorLayerEditPassthrough::renameAttribute ( int  attr,
const QString newName 
)
overridevirtual

Renames an attribute field (but does not commit it)

Parameters
attrattribute index
newNamenew name of field
Note
added in QGIS 2.16

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 157 of file qgsvectorlayereditpassthrough.cpp.

◆ rollBack()

void QgsVectorLayerEditPassthrough::rollBack ( )
overridevirtual

Stop editing and discard the edits.

Reimplemented from QgsVectorLayerEditBuffer.

Definition at line 176 of file qgsvectorlayereditpassthrough.cpp.


The documentation for this class was generated from the following files: