QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
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.
 
 ~QgsReadWriteContext ()
 
MAYBE_UNUSED NODISCARD QgsReadWriteContextCategoryPopper enterCategory (const QString &category, const QString &details=QString()) const
 Push a category to the stack.
 
const QgsPathResolverpathResolver () const
 Returns path resolver for conversion between relative and absolute paths.
 
const QgsProjectTranslatorprojectTranslator () const
 Returns the project translator.
 
void pushMessage (const QString &message, Qgis::MessageLevel level=Qgis::MessageLevel::Warning) const
 Append a message to the context.
 
void setPathResolver (const QgsPathResolver &resolver)
 Sets up path resolver for conversion between relative and absolute paths.
 
void setProjectTranslator (QgsProjectTranslator *projectTranslator)
 Sets the project translator.
 
void setTransformContext (const QgsCoordinateTransformContext &transformContext)
 Sets data coordinate transform context to transformContext.
 
QList< QgsReadWriteContext::ReadWriteMessagetakeMessages ()
 Returns the stored messages and remove them.
 
QgsCoordinateTransformContext transformContext () const
 Returns data provider coordinate transform context.
 

Friends

class QgsReadWriteContextCategoryPopper
 

Detailed Description

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

Definition at line 33 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() 
) const

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()) const
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 127 of file qgsreadwritecontext.h.

◆ pushMessage()

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

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 Symbol Documentation

◆ QgsReadWriteContextCategoryPopper

friend class QgsReadWriteContextCategoryPopper
friend

Definition at line 164 of file qgsreadwritecontext.h.


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