1

I've created a map tool to add some functionality to adding point features in QGIS 2.0. I'd like to unset this map tool if editing has manually been terminated by user. I've attempted as shown below, but my map tool remains active even after editing is terminated.

if not self.myLayer.isEditable():
    self.canvas.unsetMapTool(self.clickTool)

1 Answer 1

1

You need to connect the editingStopped signal of the layer being edited to a method in your code to unset the map tool.

layer.editingStopped.connect(self.unset_my_map_tool)
...
def unset_my_map_tool(self):
    self.canvas.unsetMapTool(self.clickTool)
1
  • okay, that worked. i was confused, as this isn't the same way I set the map tool.
    – user25976
    Commented Jun 4, 2014 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.