Graphics Reference
In-Depth Information
feature.setAttribute("type", type_attr)
feature.setAttribute("name", name_attr)
feature.setAttribute("direction", direction_attr)
feature.setAttribute("status", status_attr)
With the TrackInfoDialog class defined, we can finally implement the
onGetInfo() method (in our ForestTrailsWindow class) to display the clicked-
on track's attributes in the dialog box, and save the changes if the user clicks on the OK
button:
def onGetInfo(self, feature):
dialog = TrackInfoDialog(self)
dialog.loadAttributes(feature)
if dialog.exec_():
dialog.saveAttributes(feature)
self.trackLayer.updateFeature(feature)
self.modified = True
self.mapCanvas.refresh()
You should now be able to run the program, switch to the editing mode, click on the Get
Info toolbar icon, and then click on a feature to display the attributes for that feature. The
resulting dialog window should look like this:
Search WWH ::




Custom Search