QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
Classes | Public Member Functions | Friends | List of all members
QgsReadWriteContext Class Reference

The class is used as a container of context for various read/write operations on other objects. More...

#include <qgsreadwritecontext.h>

Classes

struct  ReadWriteMessage
 Struct for QgsReadWriteContext error or warning messages. More...
 

Public Member Functions

 QgsReadWriteContext ()
 Constructor for QgsReadWriteContext. More...
 
 ~QgsReadWriteContext ()
 
MAYBE_UNUSED NODISCARD QgsReadWriteContextCategoryPopper enterCategory (const QString &category, const QString &details=QString())
 Push a category to the stack. More...
 
const QgsPathResolverpathResolver () const
 Returns path resolver for conversion between relative and absolute paths. More...
 
const QgsProjectTranslatorprojectTranslator () const
 Returns the project translator. More...
 
void pushMessage (const QString &message, Qgis::MessageLevel level=Qgis::Warning)
 Append a message to the context. More...
 
void setPathResolver (const QgsPathResolver &resolver)
 Sets up path resolver for conversion between relative and absolute paths. More...
 
void setProjectTranslator (QgsProjectTranslator *projectTranslator)
 Sets the project translator. More...
 
void setTransformContext (const QgsCoordinateTransformContext &transformContext)
 Sets data coordinate transform context to transformContext. More...
 
QList< QgsReadWriteContext::ReadWriteMessagetakeMessages ()
 Returns the stored messages and remove them. More...
 
QgsCoordinateTransformContext transformContext () const
 Returns data provider coordinate transform context. More...
 

Friends

class QgsReadWriteContextCategoryPopper
 

Detailed Description

The class is used as a container of context for various read/write operations on other objects.

Since
QGIS 3.0

Definition at line 34 of file qgsreadwritecontext.h.

Constructor & Destructor Documentation

◆ QgsReadWriteContext()

PRIVATE QgsReadWriteContext::QgsReadWriteContext ( )

Constructor for QgsReadWriteContext.

Definition at line 35 of file qgsreadwritecontext.cpp.

◆ ~QgsReadWriteContext()

QgsReadWriteContext::~QgsReadWriteContext ( )

Definition at line 41 of file qgsreadwritecontext.cpp.

Member Function Documentation

◆ enterCategory()

QgsReadWriteContextCategoryPopper QgsReadWriteContext::enterCategory ( const QString &  category,
const QString &  details = QString() 
)

Push a category to the stack.

Note
The return value should always be used so category can be automatically left.
It is not aimed at being used in Python. Instead use the context manager.
with QgsReadWriteContext.enterCategory(context, category, details):
# do something
The class is used as a container of context for various read/write operations on other objects.
MAYBE_UNUSED NODISCARD QgsReadWriteContextCategoryPopper enterCategory(const QString &category, const QString &details=QString())
Push a category to the stack.
Since
QGIS 3.2

Definition at line 62 of file qgsreadwritecontext.cpp.

◆ pathResolver()

const QgsPathResolver & QgsReadWriteContext::pathResolver ( ) const

Returns path resolver for conversion between relative and absolute paths.

Definition at line 47 of file qgsreadwritecontext.cpp.

◆ projectTranslator()

const QgsProjectTranslator* QgsReadWriteContext::projectTranslator ( ) const
inline

Returns the project translator.

Since
QGIS 3.4

Definition at line 108 of file qgsreadwritecontext.h.

◆ pushMessage()

void QgsReadWriteContext::pushMessage ( const QString &  message,
Qgis::MessageLevel  level = Qgis::Warning 
)

Append a message to the context.

Since
QGIS 3.2

Definition at line 57 of file qgsreadwritecontext.cpp.

◆ setPathResolver()

void QgsReadWriteContext::setPathResolver ( const QgsPathResolver resolver)

Sets up path resolver for conversion between relative and absolute paths.

Definition at line 52 of file qgsreadwritecontext.cpp.

◆ setProjectTranslator()

void QgsReadWriteContext::setProjectTranslator ( QgsProjectTranslator projectTranslator)

Sets the project translator.

It's usually the QgsProject where the function with the context is made and won't be changed anymore.

Since
QGIS 3.4

Definition at line 87 of file qgsreadwritecontext.cpp.

◆ setTransformContext()

void QgsReadWriteContext::setTransformContext ( const QgsCoordinateTransformContext transformContext)

Sets data coordinate transform context to transformContext.

See also
transformContext()
Since
QGIS 3.8

Definition at line 82 of file qgsreadwritecontext.cpp.

◆ takeMessages()

QList< QgsReadWriteContext::ReadWriteMessage > QgsReadWriteContext::takeMessages ( )

Returns the stored messages and remove them.

Since
QGIS 3.2

Definition at line 93 of file qgsreadwritecontext.cpp.

◆ transformContext()

QgsCoordinateTransformContext QgsReadWriteContext::transformContext ( ) const

Returns data provider coordinate transform context.

See also
setTransformContext()
Since
QGIS 3.8

Definition at line 77 of file qgsreadwritecontext.cpp.

Friends And Related Function Documentation

◆ QgsReadWriteContextCategoryPopper

friend class QgsReadWriteContextCategoryPopper
friend

Definition at line 145 of file qgsreadwritecontext.h.


The documentation for this class was generated from the following files: