6

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

2 Answers 2

8

You want the .isEditable() method:

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

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

layer.editingStarted.connect(yourfunction)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.