QgsProjectDirtyBlocker class

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

Constructors, destructors, conversion operators

QgsProjectDirtyBlocker(QgsProject* project)
Constructor for QgsProjectDirtyBlocker.
QgsProjectDirtyBlocker(const QgsProjectDirtyBlocker& other) deleted
QgsProjectDirtyBlocker cannot be copied.

Public functions

auto operator=(const QgsProjectDirtyBlocker& other) -> QgsProjectDirtyBlocker& deleted
QgsProjectDirtyBlocker cannot be copied.

Function documentation

QgsProjectDirtyBlocker::QgsProjectDirtyBlocker(QgsProject* project)

Constructor for QgsProjectDirtyBlocker.

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