Class: QgsProjectDirtyBlocker¶
- class qgis.core.QgsProjectDirtyBlocker(project: QgsProject)¶
Bases:
sip.wrapper
Constructor for QgsProjectDirtyBlocker.
This will block dirtying the specified
project
for the lifetime of this object.Temporarily blocks
QgsProject
“dirtying” for the lifetime of the object.QgsProjectDirtyBlocker
supports “stacked” blocking, so twoQgsProjectDirtyBlockers
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, useQgsProject.blockDirtying()
.. code-block:: pythonproject = QgsProject.instance() with QgsProject.blockDirtying(project):
# do something
See also
New in version 3.2: