I'm trying to apply customization settings to QGIS consistently at two moments:

  1. When QGIS opens;
  2. When new project (with some layers) is loaded.

My code:

from qgis.utils import iface
from qgis.core import QgsProject

def customize():


At first moment code works well. But legendLayersAdded signal works only after I'm adding any other layer to an already loaded project.

Is there a signal emitted after any project (new one or existing with some layers) was loaded into QGIS?

  • You made me look into the documentation. Closest I can find is readProject emitted when project is being read [signal]. Sounds about what you are after.
    – Miro

I looked a bit more into the documentation, and apart for QgsProject, there are also QgisInterface signals:

newProjectCreated Emitted when starting an entirely new project note This is similar to projectRead(); plug-ins might want to be notified that they’re in a new project.

projectRead Emitted when a project file is successfully read note This is useful for plug-ins that store properties with project files.

Complete description e.g.: https://qgis.org/pyqgis/3.2/gui/other/QgisInterface.html


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.