Graphics Reference
In-Depth Information
Both commitChanges() and rollBack() turn off the editing mode, hiding the ver-
tex markers and erasing the contents of the editing buffer.
Note
When you use the layer's editing mode, you must use the various methods in QgsVect-
orLayer to modify the features, rather than using the equivalent methods in the data
provider. For example, you should call layer.addFeature(feature) instead of
layer.dataProvider().addFeatures([feature]) .
The layer's editing methods only work when the layer is in the editing mode. These meth-
ods add the changes to the internal editing buffer so that they can be committed or rolled
back at the appropriate time. If you make your changes directly to the data provider, you
will bypass the editing buffer, so the rollback feature won't work.
Now that we have seen the overall process used to edit the contents of a map layer, let's
create some map tools that will let the user add and edit geospatial data.
Search WWH ::




Custom Search