Skip to content
Permalink
Browse files

Update doc and add python binding

  • Loading branch information
pblottiere committed Apr 6, 2018
1 parent 333cf42 commit 032e08294c787b8f894e10a732ad8abff08c7835
@@ -954,6 +954,39 @@ class QgsVectorLayer : QgsMapLayer
*/
bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );

/**
* Changes attributes' values for a feature (but does not immediately
* commit the changes).
* The \a fid argument specifies the ID of the feature to be changed.
*
* The new values to be assigned to the fields are given by \a newValues.
*
* If a valid QVariant is specified for a field in \a oldValues, it will be
* used as the field value in the case of an undo operation corresponding
* to this attribute value change. If an invalid QVariant is used (the
* default behavior), then the feature's current value will be
* automatically retrieved and used. Note that this involves a feature
* request to the underlying data provider, so it is more efficient to
* explicitly pass an oldValue if it is already available.
*
* Returns true if feature's attributes was successfully changed.
*
* @note Calls to changeAttributeValues() are only valid for layers in
* which edits have been enabled by a call to startEditing(). Changes made
* to features using this method are not committed to the underlying data
* provider until a commitChanges() call is made. Any uncommitted changes
* can be discarded by calling rollBack().
*
* @see startEditing()
* @see commitChanges()
* @see changeGeometry()
* @see updateFeature()
* @see changeAttributeValue()
*
* @note added in QGIS 2.18
*/
bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues );

/** Add an attribute field (but does not commit it)
* returns true if the field was added
*/
@@ -70,7 +70,12 @@ class QgsVectorLayerEditBuffer : QObject
/** Stop editing and discard the edits */
virtual void rollBack();


/**
* Changes values of attributes (but does not commit it).
* @return true if attributes are well updated, false otherwise
* @note added in QGIS 2.18
*/
virtual bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues );

/** New features which are not commited. */
const QgsFeatureMap& addedFeatures();
@@ -12,6 +12,7 @@ class QgsVectorLayerEditPassthrough : QgsVectorLayerEditBuffer
bool deleteFeatures( const QgsFeatureIds& fids );
bool changeGeometry( QgsFeatureId fid, QgsGeometry* geom );
bool changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue = QVariant() );
bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues );
bool addAttribute( const QgsField &field );
bool deleteAttribute( int attr );
bool renameAttribute( int attr, const QString& newName );
@@ -1364,19 +1364,19 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
*
* Returns true if feature's attributes was successfully changed.
*
* \note Calls to changeAttributeValues() are only valid for layers in
* @note Calls to changeAttributeValues() are only valid for layers in
* which edits have been enabled by a call to startEditing(). Changes made
* to features using this method are not committed to the underlying data
* provider until a commitChanges() call is made. Any uncommitted changes
* can be discarded by calling rollBack().
*
* \see startEditing()
* \see commitChanges()
* \see changeGeometry()
* \see updateFeature()
* \see changeAttributeValue()
* @see startEditing()
* @see commitChanges()
* @see changeGeometry()
* @see updateFeature()
* @see changeAttributeValue()
*
* \since QGIS 2.18
* @note added in QGIS 2.18
*/
bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues );

@@ -101,8 +101,8 @@ class CORE_EXPORT QgsVectorLayerEditBuffer : public QObject

/**
* Changes values of attributes (but does not commit it).
* \returns true if attributes are well updated, false otherwise
* \since QGIS 2.18
* @return true if attributes are well updated, false otherwise
* @note added in QGIS 2.18
*/
virtual bool changeAttributeValues( QgsFeatureId fid, const QgsAttributeMap &newValues, const QgsAttributeMap &oldValues );

0 comments on commit 032e082

Please sign in to comment.
You can’t perform that action at this time.