QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgsvectorlayereditpassthrough.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorlayereditpassthrough.h
3 ---------------------
4 begin : Jan 12 2015
5 copyright : (C) 2015 by Sandro Mani
6 email : manisandro at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QGSVECTORLAYEREDITPASSTHROUGH_H
16#define QGSVECTORLAYEREDITPASSTHROUGH_H
17
18#include "qgis_core.h"
20
21class QgsVectorLayer;
23class QgsTransaction;
24
25#ifdef SIP_RUN
26// clang-format off
27% ModuleHeaderCode
29% End
30// clang-format on
31#endif
32
39{
40#ifdef SIP_RUN
42 if ( qobject_cast<QgsVectorLayerEditPassthrough *>( sipCpp ) )
43 sipType = sipType_QgsVectorLayerEditPassthrough;
44 else
45 sipType = nullptr;
47#endif
48
49 // clang-format off
50 Q_OBJECT
51
52 public:
53 // clang-format on
54
56 bool isModified() const override;
57 bool addFeature( QgsFeature &f ) override;
58 bool addFeatures( QgsFeatureList &features ) override;
59 bool deleteFeature( QgsFeatureId fid ) override;
60 bool deleteFeatures( const QgsFeatureIds &fids ) override;
61 bool changeGeometry( QgsFeatureId fid, const QgsGeometry &geom ) override;
62 bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() ) override;
63
68 bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues ) override;
69
70 bool addAttribute( const QgsField &field ) override;
71 bool deleteAttribute( int attr ) override;
72 bool renameAttribute( int attr, const QString &newName ) override;
73 bool commitChanges( QStringList &commitErrors ) override;
74 void rollBack() override;
75
86 bool update( QgsTransaction *transaction, const QString &sql, const QString &name );
87
88 private:
89 bool mModified = false;
90
91 // utility function to avoid cpy/paste
92 bool modify( QgsVectorLayerUndoPassthroughCommand *cmd );
93};
94
95#endif // QGSVECTORLAYEREDITPASSTHROUGH_H
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:60
Encapsulate a field in an attribute table or data source.
Definition qgsfield.h:56
A geometry is the spatial representation of a feature.
Allows creation of a multi-layer database-side transaction.
virtual bool deleteFeature(QgsFeatureId fid)
Delete a feature from the layer (but does not commit it).
virtual bool renameAttribute(int attr, const QString &newName)
Renames an attribute field (but does not commit it).
virtual bool deleteFeatures(const QgsFeatureIds &fid)
Deletes a set of features from the layer (but does not commit it).
virtual bool addAttribute(const QgsField &field)
Adds an attribute field (but does not commit it) returns true if the field was added.
virtual bool addFeatures(QgsFeatureList &features)
Insert a copy of the given features into the layer (but does not commit it).
virtual bool changeAttributeValues(QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues)
Changes values of attributes (but does not commit it).
virtual bool isModified() const
Returns true if the provider has been modified since the last commit.
virtual bool addFeature(QgsFeature &f)
Adds a feature.
virtual void rollBack()
Stop editing and discard the edits.
QgsVectorLayerEditBuffer(QgsVectorLayer *layer)
virtual bool commitChanges(QStringList &commitErrors)
Attempts to commit any changes to disk.
virtual bool deleteAttribute(int attr)
Deletes an attribute field (but does not commit it).
virtual bool changeAttributeValue(QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue=QVariant())
Changed an attribute value (but does not commit it).
virtual bool changeGeometry(QgsFeatureId fid, const QgsGeometry &geom)
Change feature's geometry.
bool update(QgsTransaction *transaction, const QString &sql, const QString &name)
Update underlying data with a SQL query embedded in a transaction.
Undo command for vector layer in a transaction group mode.
Represents a vector layer which manages a vector based dataset.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:198
#define SIP_END
Definition qgis_sip.h:215
QMap< int, QVariant > QgsAttributeMap
QList< QgsFeature > QgsFeatureList
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features