Represents a template (or set of templates) that can be rendered using a supplied context.
More...
Doesn't do anything fancy - no logic is allowed in the templates - it just does a simple replacement of all placeholder tokens using the supplied context. Placeholders are identified by being surrounded by {% %} characters, e.g:
{% Placeholder %}
Placeholder tokens can be escaped with a single backslash. For example:
\{% Placeholder %}
Will cause the text, "{% Placeholder %}" to be rendered, as the placeholder will be ignored.
The context is a map of token name -> qvariant, where the variant can be any of:
- A string (it will be rendered verbatim)
- An int, float or double (it will be rendered as a string)
- Anything that can be converted to a string list (it will be rendered split with newlines)
- Anything convertible to a QVariantList or QVariantMap
Elements in lists (e.g. ObjectArrays) can be accessed using the usual index notation. For example:
{% Placeholder[0] %}
Will access the 0th element of the array Placeholder in the context passed to the render() method. Elements in maps (e.g. ObjectDictionaries) can be accessed using the expected dot notations. For example:
{% Placeholder.Member %}
Will access the Member member of the Placeholder dictionary.