2

I'm looking for a way to send a signal if a layer is in editing mode. I tried editingStarted(), but it wasn't working. I'd like to do something along the lines of the what I have below, but can't find it in the API (where I'm looking: http://qgis.org/api/classQgsVectorLayer.html#a476eaf6ec8f2a45e285e963bcacedcc2)

qgis.utils.iface.setActiveLayer(myLayer)
#capslock is in place of the method i'm searching
if myLayer.ISINEDITMODE() == False:
    qgis.utils.iface.actionToggleEditing().trigger()
3

You want the isEditable method:

if not myLayer.isEditable():
    iface.actionToggleEditing.trigger()
0

If you're after the signal you define it like this:

layer.editingStarted.connect(yourfunction)

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.