GrantleeTheme::GenericFormatter Class

Convenience class for using a Grantlee theme. More...

Header: #include <GrantleeTheme/GenericFormatter>
CMake: find_package(KPim6 REQUIRED COMPONENTS GrantleeTheme)
target_link_libraries(mytarget PRIVATE KPim6::GrantleeTheme)

Public Functions

GenericFormatter()
GenericFormatter(const QString &defaultHtmlMain, const QString &themePath)
~GenericFormatter()
QString errorMessage() const
void reloadTemplate()
QString render(const QVariantHash &mapping) const
void setApplicationDomain(const QByteArray &domain)
void setDefaultHtmlMainFile(const QString &name)
void setTemplateContent(const QString &content)
void setTemplatePath(const QString &path)

Detailed Description

Member Function Documentation

GenericFormatter::GenericFormatter()

Constructs a GenericFormatter object.

[explicit] GenericFormatter::GenericFormatter(const QString &defaultHtmlMain, const QString &themePath)

Constructs a GenericFormatter object with specified HTML template and theme path. defaultHtmlMain The default HTML main template filename themePath The path to the theme directory

[noexcept] GenericFormatter::~GenericFormatter()

Destroys the GenericFormatter object.

QString GenericFormatter::errorMessage() const

Returns the last error message if rendering failed. Returns The error message, or an empty string if no error

void GenericFormatter::reloadTemplate()

Reloads the template from the file system.

QString GenericFormatter::render(const QVariantHash &mapping) const

Renders the template with the given variable mappings. mapping A hash of variable names and their values Returns The rendered template output as a QString

void GenericFormatter::setApplicationDomain(const QByteArray &domain)

Sets the translation domain for the Grantlee localizer. domain The translation domain to use

void GenericFormatter::setDefaultHtmlMainFile(const QString &name)

Sets the default HTML main template file. name The filename of the HTML template

void GenericFormatter::setTemplateContent(const QString &content)

Sets the template content from a string rather than loading from a file. content The template content as a string

void GenericFormatter::setTemplatePath(const QString &path)

Sets the path to the template directory. path The template directory path