QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Public Member Functions | List of all members
QgsProjectDirtyBlocker Class Reference

Temporarily blocks QgsProject "dirtying" for the lifetime of the object. More...

#include <qgsproject.h>

Public Member Functions

 QgsProjectDirtyBlocker (const QgsProjectDirtyBlocker &other)=delete
 QgsProjectDirtyBlocker cannot be copied. More...
 
 QgsProjectDirtyBlocker (QgsProject *project)
 Constructor for QgsProjectDirtyBlocker. More...
 
 ~QgsProjectDirtyBlocker ()
 
QgsProjectDirtyBlockeroperator= (const QgsProjectDirtyBlocker &other)=delete
 QgsProjectDirtyBlocker cannot be copied. More...
 

Detailed Description

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()

with QgsProject.blockDirtying(project):
# do something
See also
QgsProject::setDirty()
Since
QGIS 3.2

Definition at line 2107 of file qgsproject.h.

Constructor & Destructor Documentation

◆ QgsProjectDirtyBlocker() [1/2]

QgsProjectDirtyBlocker::QgsProjectDirtyBlocker ( QgsProject project)
inline

Constructor for QgsProjectDirtyBlocker.

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

Definition at line 2116 of file qgsproject.h.

◆ QgsProjectDirtyBlocker() [2/2]

QgsProjectDirtyBlocker::QgsProjectDirtyBlocker ( const QgsProjectDirtyBlocker other)
delete

QgsProjectDirtyBlocker cannot be copied.

◆ ~QgsProjectDirtyBlocker()

QgsProjectDirtyBlocker::~QgsProjectDirtyBlocker ( )
inline

Definition at line 2128 of file qgsproject.h.

Member Function Documentation

◆ operator=()

QgsProjectDirtyBlocker& QgsProjectDirtyBlocker::operator= ( const QgsProjectDirtyBlocker other)
delete

QgsProjectDirtyBlocker cannot be copied.


The documentation for this class was generated from the following file:
QgsProject::instance
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:468