18 : mProjectTranslator( &mDefaultTranslator )
26 Q_ASSERT( mCategories.isEmpty() );
36 mPathResolver = resolver;
46 QString message = category;
47 if ( !details.isEmpty() )
48 message.append( QStringLiteral(
" :: %1" ).arg( details ) );
49 mCategories.push_back( message );
53 void QgsReadWriteContext::leaveCategory()
55 if ( !mCategories.isEmpty() )
56 mCategories.pop_back();
66 QList<QgsReadWriteContext::ReadWriteMessage > messages = mMessages;
71 QString QgsReadWriteContext::DefaultTranslator::translate(
const QString &context,
const QString &sourceText,
const char *disambiguation,
int n )
const 74 Q_UNUSED( disambiguation );
void setPathResolver(const QgsPathResolver &resolver)
Sets up path resolver for conversion between relative and absolute paths.
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.
Allows entering a context category and takes care of leaving this category on deletion of the class...
void pushMessage(const QString &message, Qgis::MessageLevel level=Qgis::Warning)
Append a message to the context.
MessageLevel
Level for messages This will be used both for message log and message bar in application.
friend class QgsReadWriteContextCategoryPopper
const QgsProjectTranslator * projectTranslator() const
Returns the project translator.
QgsReadWriteContext()
Constructor for QgsReadWriteContext.
Struct for QgsReadWriteContext error or warning messages.
QList< QgsReadWriteContext::ReadWriteMessage > takeMessages()
Returns the stored messages and remove them.
Wherever an object of this class is available, the derived translate function can be called from...
const QgsPathResolver & pathResolver() const
Returns path resolver for conversion between relative and absolute paths.
Resolves relative paths into absolute paths and vice versa.