I want to disable editing some (but not all) layers in one QGIS project, while still having them editable in a different project.

Is it possible to disable editing certain layers within a QGIS project without making the actual data read-only?

2 Answers 2


It is possible to make a layer not editable in a specific project.

Open Project properties > Data sources and check the option Read Only for the layers that you want to make not editable.

enter image description here


You can also use one line python script. Select a layer and run the script:


According to the documentation, if the layer is in editing, it returns False.

  • 1
    is it possible to set for selected layers at once ?
    – Noura
    Feb 25, 2020 at 15:53
  • Afaik, there is no a method for that. Though, these one line codes could be useful: [lyr.setReadOnly(False) for lyr in iface.layerTreeView().selectedLayers()] or list(map(lambda l: l.setReadOnly(True), iface.layerTreeView().selectedLayers())) Mar 2, 2020 at 20:00

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.