Filter Reference
In addition to the built-in Jinja filters listed here, the following additional features are implemented in the ivigenerator.
return_type(symbol)
Returns the C++ type for the passed symbol.
E.g. QString for a symbol of type "string".
parameter_type(symbol)
Return the C++ type for the passed symbol. This returns the same type as return_type(), but already prepared to be used as a parameter for methods.
E.g. "const QString &<name>" for a symbol of type "string"
getter_name(symbol)
Returns the getter name of the property, if defined by the @getter_name
annotation. Otherwise retuns the passed symbol.
setter_name(symbol)
Returns the setter name of the property, if defined by the @setter_name
annotation. Otherwise retuns the passed symbol.
default_type_value(symbol)
Returns the default value for the passed symbol. Models are initialized as nullptr
default_value(symbol, zone="=")
Returns the default value for the passed symbol set by the @default
annotation. If not set uses default_type_value
instead.
The zone parameter is used to identify different default values per zone.
model_type(symbol)
Returns the C++ class name for this model.
flag_type(symbol)
Returns the name defined by the @type
annotation for the passed flag. If this is not set, tries to pluralize the passed name by adding an 's' at the end.
parse_doc(string)
Parses the passed comment string and adds every javadoc command into its own group. Sentences without tag are put into the 'description' group.
{% with doc = comments|parse_doc -%} {% if doc.brief %} \brief {{doc.brief}} {% endif %} {% if doc.description %} {{doc.description}} {% endif %} {% endwith %}
lowerfirst(string)
Only lowers the first character of the given string.
range_low(property)
Returns the minimum value for the passed property using the @range
or @minimum
annotations.
range_high(property)
Returns the maximum value for the passed property using the @range
or @maximum
annotations.
strip_QT(string)
Removes the 'QT' at the beginning, if the string starts with it.
domain_values(symbol)
Returns the domain values for the passed property using the @domain
annotation.
enum_value(value, module_name)
Returns the fully qualified C++ name of the given value. The passed module_name is used as C++ class name containing the enum.
Also supports passing '|' connected values.
tag_by_path(symbol, path, default_value=False)
Find the tag given by its full path in the object hierarchy, like property.config_sim.zones.right
. If some parts of the path are missing, return None
.
conf_sim_tag(symbol, path, default_value=False)
Find the tag, given by its path, located under the "config_simulator" sub-object. Returns None
, if parts of the path are missing.
jsonify(obj)
Returns a JSON representation of the given obj.
has_domains(properties)
Returns true
if any of the given properties has @range
or @domain
annotations.
json_domain(properties)
Returns the property domains for the given properties formated in JSON.
qml_type(interface)
Returns the name of the interface for use in QML. This name is defined by the @qml_type
annotation. This annotation is optional: if not provided, the interface name is used.
qml_control(symbol, backend_obj)
Returns the QML code for the control (or group of controls) to represent the editing UI for the passed symbol.
qml_binding_property(symbol)
Returns the name of the property of the QML control to be bound with.
E.g. "value" for a Slider and "checked" for a CheckBox.
qml_control_signal_parameters(symbol)
Returns the parameters for calling the signal using the values from the UI controls.
struct_includes(symbol)
Returns the includes for the structs that the interface or a struct depends on. The returned strings are complete and in format #include "struct.h".
© 2020 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.