QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
22 QString
translate(
const QString &context,
const QString &sourceText,
const char *disambiguation,
int n )
const override
25 Q_UNUSED( disambiguation )
36 : mProjectTranslator( sDefaultTranslator() )
44 Q_ASSERT( mCategories.isEmpty() );
54 mPathResolver = resolver;
64 QString message = category;
65 if ( !details.isEmpty() )
66 message.append( QStringLiteral(
" :: %1" ).arg( details ) );
67 mCategories.push_back( message );
71 void QgsReadWriteContext::leaveCategory()
73 if ( !mCategories.isEmpty() )
74 mCategories.pop_back();
79 return mCoordinateTransformContext;
95 QList<QgsReadWriteContext::ReadWriteMessage > messages = mMessages;
void setPathResolver(const QgsPathResolver &resolver)
Sets up path resolver for conversion between relative and absolute paths.
Contains information about the context in which a coordinate transform is executed.
The class is used as a container of context for various read/write operations on other objects.
void setTransformContext(const QgsCoordinateTransformContext &transformContext)
Sets data coordinate transform context to transformContext.
Struct for QgsReadWriteContext error or warning messages.
QgsCoordinateTransformContext transformContext() const
Returns data provider coordinate transform context.
void setProjectTranslator(QgsProjectTranslator *projectTranslator)
Sets the project translator.
MAYBE_UNUSED NODISCARD QgsReadWriteContextCategoryPopper enterCategory(const QString &category, const QString &details=QString())
Push a category to the stack.
Q_GLOBAL_STATIC(QReadWriteLock, sDefinitionCacheLock)
void pushMessage(const QString &message, Qgis::MessageLevel level=Qgis::Warning)
Append a message to the context.
Allows entering a context category and takes care of leaving this category on deletion of the class.
const QgsProjectTranslator * projectTranslator() const
Returns the project translator.
friend class QgsReadWriteContextCategoryPopper
Wherever an object of this class is available, the derived translate function can be called from.
MessageLevel
Level for messages This will be used both for message log and message bar in application.
QList< QgsReadWriteContext::ReadWriteMessage > takeMessages()
Returns the stored messages and remove them.
Resolves relative paths into absolute paths and vice versa.
virtual QString translate(const QString &context, const QString &sourceText, const char *disambiguation=nullptr, int n=-1) const =0
The derived translate() translates with QTranslator and qm file the sourceText.
const QgsPathResolver & pathResolver() const
Returns path resolver for conversion between relative and absolute paths.