Class: QgsProjectDirtyBlocker¶
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()
project = QgsProject.instance()
with QgsProject.blockDirtying(project):
# do something
See also
QgsProject.setDirty()
Added in version 3.2.
- class qgis.core.QgsProjectDirtyBlocker[source]¶
Bases:
object- __init__(project: QgsProject | None)
Constructor for QgsProjectDirtyBlocker.
This will block dirtying the specified
projectfor the lifetime of this object.- Parameters:
project (Optional[QgsProject])