aboutsummaryrefslogtreecommitdiffstats
path: root/src/ivicore/doc/src/ivigenerator/filter-reference.qdoc
blob: c202205c8e6eaccd199d7e04379befc6722fee70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2019 Luxoft Sweden AB
** Copyright (C) 2018 Pelagicore AG
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
\page filter-reference.html
\title Filter Reference
\previouspage Use the Generator
\nextpage Qmake Integration

In addition to the built-in Jinja filters listed \l
{http://jinja.pocoo.org/docs/2.9/templates/#list-of-builtin-filters} {here}, the following
additional features are implemented in the ivigenerator.

\section1 Filters

\target return_type(symbol)
\target return_type()
\section2 return_type(symbol)

Returns the C++ type for the passed symbol.

E.g. QString for a symbol of type "string".

\target parameter_type(symbol)
\section2 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"

\target getter_name(symbol)
\section2 getter_name(symbol)

Returns the getter name of the property, if defined by the \c @getter_name annotation. Otherwise
retuns the passed symbol.

\target setter_name(symbol)
\section2 setter_name(symbol)

Returns the setter name of the property, if defined by the \c @setter_name annotation. Otherwise
retuns the passed symbol.

\target default_type_value(symbol)
\section2 default_type_value(symbol)

Returns the default value for the passed symbol. Models are initialized as \c nullptr

\target default_value(symbol, zone="=")
\section2 default_value(symbol, zone="=")

\note This filter is deprecated and will be removed in future Qt versions.

Returns the default value for the passed symbol set by the \c @default annotation. If not set uses
\c default_type_value instead.

The zone parameter is used to identify different default values per zone.

\target model_type(symbol)
\section2 model_type(symbol)

\note This filter is deprecated and will be removed in future Qt versions.

Returns the C++ class name for this model.

\target flag_type(symbol)
\section2 flag_type(symbol)

Returns the name defined by the \c @type annotation for the passed flag. If this is not set, tries to
pluralize the passed name by adding an 's' at the end.

\target parse_doc(string)
\section2 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.

\badcode
{% with doc = comments|parse_doc -%}
{% if doc.brief %}    \brief {{doc.brief}}
{% endif %}

{% if doc.description %}
    {{doc.description}}
{% endif %}
{% endwith %}
\endcode

\target lowerfirst(string)
\section2 lowerfirst(string)

Only lowers the first character of the given string.

\target range_low(property)
\section2 range_low(property)

\note This filter is deprecated and will be removed in future Qt versions.

Returns the minimum value for the passed property using the \c @range or \c @minimum annotations.

\target range_high(property)
\section2 range_high(property)

\note This filter is deprecated and will be removed in future Qt versions.

Returns the maximum value for the passed property using the \c @range or \c @maximum annotations.

\target strip_QT(string)
\section2 strip_QT(string)

Removes the 'QT' at the beginning, if the string starts with it.

\target domain_values(symbol)
\section2 domain_values(symbol)

\note This filter is deprecated and will be removed in future Qt versions.

Returns the domain values for the passed property using the \c @domain annotation.

\target enum_value(value, module_name)
\section2 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.

\target tag_by_path(symbol, path, default_value=False)
\section2 tag_by_path(symbol, path, default_value=False)

\note This filter is deprecated and will be removed in future Qt versions.

Find the tag given by its full path in the object hierarchy, like
\c property.config_sim.zones.right. If some parts of the path are missing, return \c None.

\target conf_sim_tag(symbol, path, default_value=False)
\section2 conf_sim_tag(symbol, path, default_value=False)

\note This filter is deprecated and will be removed in future Qt versions.

Find the tag, given by its path, located under the "config_simulator" sub-object. Returns \c None,
if parts of the path are missing.

\target jsonify(obj)
\section2 jsonify(obj)

Returns a JSON representation of the given obj.

\target has_domains(properties)
\section2 has_domains(properties)

\note This filter is deprecated and will be removed in future Qt versions.

Returns \c true if any of the given properties has \c @range or \c @domain annotations.

\target json_domain(properties)
\section2 json_domain(properties)

\note This filter is deprecated and will be removed in future Qt versions.

Returns the property domains for the given properties formated in JSON.

\target qml_type(interface)
\section2 qml_type(interface)

Returns the name of the interface/module for use in QML. This name is defined by the \c @qml_type
annotation. This annotation is optional: if not provided, the interface name is used, for modules
module_name is used.

\target qml_control(symbol, backend_obj)
\section2 qml_control(symbol, backend_obj)

\note This filter is deprecated and will be removed in future Qt versions.

Returns the QML code for the control (or group of controls) to represent the editing UI for the
passed symbol.

\target qml_binding_property(symbol)
\section2 qml_binding_property(symbol)

\note This filter is deprecated and will be removed in future Qt versions.

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.

\target qml_control_signal_parameters(symbol)
\section2 qml_control_signal_parameters(symbol)

\note This filter is deprecated and will be removed in future Qt versions

Returns the parameters for calling the signal using the values from the UI controls.

\target struct_includes(symbol)
\section2 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".

\target comment_text(comment)
\section2 comment_text(comment)

Returns the text of the passed comment without the leading/trailing comment tokens ('/**', '*').

\target qml_info_type(symbol)
\section2 qml_info_type(symbol)

Returns the correct type for the symbol, to be used inside the qmltype templates.

\section1 Global Functions

\target error(msg)
\section2 error(msg)
Throws an error with the given msg

\target warning(msg)
\section2 warning(msg)
Reports a warning with the given msg

*/