0

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)
0

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)
  • okay, that worked. i was confused, as this isn't the same way I set the map tool. – user25976 Jun 4 '14 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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