Graphics Reference
In-Depth Information
"Save changes to layer?",
QMessageBox.Yes |
QMessageBox.No,
QMessageBox.Yes)
if reply == QMessageBox.Yes:
layer.commitChanges()
else:
line.rollBack()
else:
layer.rollBack()
As you can see, we turn on the editing mode for a given map layer by calling lay-
er.startEditing() . As well as set up an internal editing buffer to hold the changes
you make, this tells the layer to visually highlight the layer's features by drawing small
vertex markers on each of the vertices, as shown in the following image:
We then allow the user to make changes to the layer's features. We will learn how this is
done in the following sections of this chapter. When the user turns off the editing mode,
we check whether any changes have been made, and if so, display a confirmation message
box to the user. Depending on the user's response, we either save the changes by calling
layer.commitChanges() or discard them by calling layer.rollBack() .
Search WWH ::




Custom Search