Class: QgsProjectDirtyBlocker

class qgis.core.QgsProjectDirtyBlocker

Bases: sip.wrapper

Temporarily blocks QgsProject “dirtying” for the lifetime of the object.

QgsProjectDirtyBlocker supports “stacked” blocking, so two QgsProjectDirtyBlockers created for the same project will both need to be destroyed before the project can be dirtied again.

Note that QgsProjectDirtyBlocker only blocks calls which set the project as dirty - calls which set the project as clean are not blocked.

Python scripts should not use QgsProjectDirtyBlocker directly. Instead, use QgsProject.blockDirtying() .. code-block:: python

project = QgsProject.instance() with QgsProject.blockDirtying(project):

# do something

New in version 3.2.

QgsProjectDirtyBlocker(project: QgsProject) Constructor for QgsProjectDirtyBlocker.

This will block dirtying the specified project for the lifetime of this object.