Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdoc-manual-macros.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2023 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page qdoc-macros.html
6
\previouspage 12-0-qdoc-commands-miscellaneous.html
7
\nextpage qdoc-macros-cmake-text-snippets.html
8
\title Macros
9
10
Use the \l {macro-variable}{macro} variable to create your own simple QDoc
11
commands.
12
13
Macros are useful for:
14
15
\list
16
\li Including recurring text, such as formatted text snippets,
17
into documentation.
18
\li Pulling in information, such as version strings, from the build
19
system into .documentation.
20
\li Maintaining a single location for strings that are likely to change
21
in the future, such as product names.
22
\li Making sure that a term or product name is used consistently.
23
\li Styling the generated documentation by using HTML and DocBook
24
elements, such as forced line breaks and special characters.
25
\li Using tabs to show examples of content for different programming
26
languages, operating systems, or tools, for example.
27
\endlist
28
29
\section1 Global Macros
30
31
For a set of predefined global macros that you can use in all documentation
32
projects and their current values, see
33
\l{https://github.com/qt/qtbase/blob/e4315204b1412d74842b3167c3eb9a49dc233355/doc/global/macros.qdocconf}
34
{/qtbase/doc/global/macros.qdocconf} and
35
\l{https://github.com/qt/qtbase/blob/e4315204b1412d74842b3167c3eb9a49dc233355/doc/global/htmltabs.qdocconf}
36
{/qtbase/doc/global/htmltabs.qdocconf}. They have macros that include:
37
38
\list
39
\li \l {CMake Text Snippets}
40
\li \l {HTML and DocBook Formatting}
41
\li \l {Product Names}
42
\li \l {Product Versions}
43
\li \l {Tabbed Content}
44
\li \l {youtube-macro}{Links to YouTube content}
45
\li \l {Miscellaneous Macros}
46
\endlist
47
48
\QOI copies the macros files to your Qt installation folder, so you can use
49
the macros even if you build the documentation using QDoc from an installed
50
Qt (as opposed to building QDoc yourself from sources).
51
52
\note The values of the global macros might change between Qt versions,
53
so the macros might be extended differently depending on the Qt version that
54
you use to build the documentation.
55
56
\section1 Adding Macros
57
58
You can add macros for a particular documentation project in the
59
.qdocconf file of the project or any .qdocconf file that you include into it.
60
If the macro could be useful in more than one documentation project, add it
61
to the global macros file.
62
63
For more information about the macro syntax and options, see
64
\l {macro-variable}{macro}.
65
66
\section1 Using Macros
67
68
You can use macros in the same way as the built-in QDoc commands in:
69
70
\list
71
\li Code source files, in documentation comments (.cpp, .qml)
72
\li Documentation source files (.qdoc, .qdocinc)
73
\endlist
74
75
For example:
76
77
\badcode
78
\QOI copies the macros files to your Qt installation folder.
79
\endcode
80
81
\section1 Obsolete Macros
82
83
The global macros file contains the following obsolete macros for
84
compatibility with older documentation sets.
85
86
\table
87
\header
88
\li Don't Use
89
\li Use
90
\row
91
\li \\gui
92
\li \l{uicontrol-command}{\\uicontrol}
93
\row
94
\li \\menu
95
\li \l{uicontrol-command}{\\uicontrol}
96
\row
97
\li \\param
98
\li \l{a-command}{\\a}
99
\row
100
\li \\return
101
\li Write \e Returns or \e returns.
102
\endtable
103
104
\sa {macro-variable}{macro}, {Unknown macro}
105
*/
106
107
/*!
108
\page qdoc-macros-cmake-text-snippets.html
109
\previouspage qdoc-macros.html
110
\nextpage qdoc-macros-formatting.html
111
112
\title CMake Text Snippets
113
114
See \l{https://github.com/qt/qtbase/blob/e4315204b1412d74842b3167c3eb9a49dc233355/doc/global/macros.qdocconf}
115
{/qtbase/doc/global/macros.qdocconf} for standard text snippets that you
116
should use when writing \l {Building with CMake}
117
{Qt-specific CMake documentation}:
118
119
\table
120
\header
121
\li Macro
122
\li Use
123
\row
124
\li \\cmakecommandandroidonly
125
\li For Android targets
126
\row
127
\li \\cmakecommandsince
128
\li To indicate which Qt version introduced the command
129
\row
130
\li \\cmakepropertyandroidonly
131
\li For Android targets
132
\row
133
\li \\cmakepropertyiosonly
134
\li For iOS targets
135
\row
136
\li \\cmakepropertysince
137
\li To indicate which Qt version introduced the property
138
\row
139
\li \\cmakepropertywebassemblyonly
140
\li For WebAssembly targets
141
\row
142
\li \\cmakevariableandroidonly
143
\li For Android targets
144
\row
145
\li \\cmakevariableiosonly
146
\li For iOS targets
147
\row
148
\li \\cmakevariablesince
149
\li To indicate which Qt version introduced the variable
150
\row
151
\li \\preliminarycmakecommand
152
\li To indicate that the command may change in future versions
153
\row
154
\li \\preliminarycmakeproperty
155
\li To indicate that the property may change in future versions
156
\row
157
\li \\preliminarycmakevariable
158
\li To indicate that the variable may change in future versions
159
\row
160
\li \\versionlessCMakeCommandsNote
161
\li For all commands, to tell users how to use versioned commands
162
\endtable
163
164
\sa {macro-variable}{macro}, {Macros}
165
*/
166
167
/*!
168
\page qdoc-macros-formatting.html
169
\previouspage qdoc-macros.html
170
\nextpage qdoc-macros-product-names.html
171
172
\title HTML and DocBook Formatting
173
174
See \l{https://github.com/qt/qtbase/blob/e4315204b1412d74842b3167c3eb9a49dc233355/doc/global/macros.qdocconf}
175
{/qtbase/doc/global/macros.qdocconf} for HTML and DocBook elements and
176
special characters that you can use in documentation source files.
177
178
\sa {Macros and Other Configurations}, {macro-variable}{macro}, {Macros}
179
180
*/
181
182
/*!
183
\page qdoc-macros-product-names.html
184
\previouspage qdoc-macros-formatting.html
185
\nextpage qdoc-macros-tabbed-content.html
186
187
\title Product Names
188
189
Use the following macros to refer to products:
190
191
\table
192
\header
193
\li Macro
194
\li Expands To
195
\row
196
\li \\B2Q
197
\li Boot to Qt
198
\row
199
\li \\B2QSS
200
\li Boot to Qt Software Stack
201
\row
202
\li \\IFW
203
\li Qt Installer Framework
204
\row
205
\li \\macos
206
\li macOS
207
\row
208
\li \\QA
209
\li Qt Assistant
210
\row
211
\li \\QB
212
\li Qt Bridge
213
\row
214
\li \\QBF
215
\li Qt Bridge for Figma
216
\row
217
\li \\QBPS
218
\li Qt Bridge for Adobe Photoshop
219
\row
220
\li \\QBSK
221
\li Qt Bridge for Sketch
222
\row
223
\li \\QBXD
224
\li Qt Bridge for Adobe XD
225
\row
226
\li \\QC
227
\li Qt Creator
228
\row
229
\li \\QD
230
\li Qt Widgets Designer
231
\row
232
\li \\QDS
233
\li Qt Design Studio
234
\row
235
\li \\QDV
236
\li Qt Design Viewer
237
\row
238
\li \\QfP
239
\li Qt for Python
240
\row
241
\li \\QL
242
\li Qt Linguist
243
\row
244
\li \\QMCU
245
\li Qt for MCUs
246
\row
247
\li \\QMLLS
248
\li QML Language Server
249
\row
250
\li \\QMLP
251
\li QML Profiler
252
\row
253
\li \\QMT
254
\li Qt Maintenance Tool
255
\row
256
\li \\QOI
257
\li Qt Online Installer
258
\row
259
\li \\QQEM
260
\li Qt Quick Effect Maker
261
\row
262
\li \\QQV
263
\li Qt QML Viewer
264
\row
265
\li \\QtAA
266
\li Qt for Android Automotive
267
\row
268
\li \\QtTAS
269
\li Qt Tools for Android Studio
270
\row
271
\li \\QUL
272
\li Qt Quick Ultralite
273
\endtable
274
275
\sa {macro-variable}{macro}, {Macros}
276
*/
277
278
/*!
279
\page qdoc-macros-product-versions.html
280
\previouspage qdoc-macros-product-names.html
281
\nextpage qdoc-macros-tabbed-content.html
282
283
\title Product Versions
284
285
Use the following macros to display version and status information about a
286
topic:
287
288
\table
289
\header
290
\li Macro
291
\li Expands To
292
\row
293
\li \\QtMajorVersion
294
\li The major version number based on the $QT_VER environment variable
295
\row
296
\li \\QtMinorVersion
297
\li The minor version number based on the $QT_VER environment variable
298
\row
299
\li \\QtVersion
300
\li The value of the $QT_VERSION environment variable
301
\row
302
\li \\QtVer
303
\li The value of the $QT_VER environment variable
304
\row
305
\li \\techpreview
306
\li The statement that a module or class is preliminary and might change
307
\endtable
308
309
\section1 \\techpreview
310
311
Appends the tech preview link to the brief sentence and adds the topic to
312
the \c tech_preview group.
313
314
Must be placed directly under a \brief command.
315
316
\sa {macro-variable}{macro}, {Macros}
317
*/
318
319
/*!
320
\page qdoc-macros-tabbed-content.html
321
\previouspage qdoc-macros-formatting.html
322
\nextpage qdoc-macros-youtube-videos.html
323
324
\title Tabbed Content
325
326
Use the following macros to create \e {tab groups} of labeled HTML tabs that
327
have comparable or alternative content. For example, you can show code
328
snippets for different programming languages.
329
330
\list
331
\li \l{tab-macro}{\\tab}
332
\li \l{tabcontent-macro}{\\tabcontent}
333
\li \l{endtabcontent-macro}{\\endtabcontent}
334
\endlist
335
336
\section1 Using Tab Macros
337
338
\badcode
339
\tab {name}{tab-id}{title}{checked}
340
\tabcontent {tab-id}
341
content
342
\endtabcontent
343
\endcode
344
345
\note These macros only work with the online template and DocBook, so you
346
usually need to use conditional text to get good results also for the
347
offline help.
348
349
For example, to show instructions for the CMake and qmake build systems in
350
tabs:
351
352
\badcode
353
\if defined(onlinedocs)
354
\tab {build-qt-app}{tab-cmake}{CMake}{checked}
355
\tab {build-qt-app}{tab-qmake}{qmake}{}
356
\tabcontent {tab-cmake}
357
\else
358
\section1 Using CMake
359
\endif
360
CMake-specific instructions go here
361
\if defined(onlinedocs)
362
\endtabcontent
363
\tabcontent {tab-qmake}
364
\else
365
\section1 Using qmake
366
\endif
367
qmake-specific instructions go here
368
\if defined(onlinedocs)
369
\endtabcontent
370
\endif
371
\endcode
372
373
\target tab-macro
374
\section1 \\tab
375
376
\badcode
377
\tab {name}{tab-id}{title}{checked}
378
\endcode
379
380
Specifies a tab in a tab group with a name, ID, title, and default state.
381
382
Use a unique \e {name} to specify which tabs belong to a tab group. That is,
383
all tabs in a group have the same name. To separate the tabs from each other,
384
give them each a unique \e {tab-id} within the group. Use this \e {tab-id}
385
as the value of the \\tabcontent macro to add content to the tab.
386
387
The \e {checked} argument selects the tab by default when the HTML page is
388
loaded. For the initially hidden tabs, pass an empty argument {}.
389
390
\target tabcontent-macro
391
\section1 \\tabcontent
392
393
\badcode
394
\tabcontent {tab-id}
395
\endcode
396
397
Adds content to the tab with the \e {tab-id} you specify.
398
399
\target endtabcontent-macro
400
\section1 \\endtabcontent
401
402
Marks the end of the tab content that you begin with \\tabcontent.
403
404
\sa {Macros}
405
*/
406
407
/*!
408
\page qdoc-macros-youtube-videos.html
409
\previouspage qdoc-macros-tabbed-content.html
410
\nextpage qdoc-macros-misc.html
411
412
\target youtube-macro
413
\title \\youtube
414
415
When generating online documentation, embeds a YouTube video in the HTML.
416
When generating offline documentation (.qch), adds an external link to the
417
video with a thumbnail image. The HTML docs show a thumbnail of the video
418
with a play button. You need to save the thumbnail in
419
\c {\images\extraimages\} in your project folder.
420
421
Use the following URL to open the thumbnail image in a browser:
422
\c {https://img.youtube.com/vi/<ID>/0.jpg}. The \c <ID> is the ID of
423
the video on YouTube. For example, if the URL to the video is
424
\c {https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=youtu.be},
425
the ID is \c dQw4w9WgXcQ. Save the image file as \c dQw4w9WgXcQ.jpg.
426
427
You must add the filename of the thumbnail file to
428
\c {\images\extraimages\extraimages.qdocconf}. For example:
429
430
\badcode
431
{HTML.extraimages,qhp.qtdesignstudio.extraFiles} += \
432
images/dQw4w9WgXcQ.jpg
433
\endcode
434
435
To add a link to the video in text, write:
436
437
\badcode
438
\youtube dQw4w9WgXcQ
439
\endcode
440
441
\sa {Macros}
442
*/
443
444
/*!
445
\page qdoc-macros-misc.html
446
\previouspage qdoc-macros-youtube-videos.html
447
\nextpage 21-0-qdoc-configuration.html
448
449
\title Miscellaneous Macros
450
451
You can use the following macros to affect the HTML output and to use
452
standard terminology:
453
454
\list
455
\li \l {borderedimage-macro}{\\borderedimage}
456
\li \l {examplecategory-macro}{\\examplecategory}
457
\li \l {key-macro}{\\key}
458
\li \l {nullptr-macro}{\\nullptr}
459
\li \l {summary-macro}{\\summary}
460
\endlist
461
462
\target borderedimage-macro
463
\section1 \\borderedimage
464
465
Like \l{image-command}{\\image}, but adds a border around the image.
466
467
\target examplecategory-macro
468
\section1 \\examplecategory
469
470
Describes the category an example is sorted to in the Qt Creator
471
\uicontrol Examples tab.
472
473
\target key-macro
474
\section1 \\key
475
476
Formats keyboard key names.
477
478
\target nullptr-macro
479
\section1 \\nullptr
480
481
Expands to the term to use for null pointers.
482
483
\target summary-macro
484
\section1 \\summary
485
486
Like \l{brief-command}{\\brief}, but replicates the sentence also as text.
487
488
Wrap the entire sentence within \c {{}}. For example:
489
490
\badcode
491
\summary {Creates a build target.}
492
\endcode
493
494
\sa {macro-variable}{macro}, {Macros}
495
*/
qttools
src
qdoc
qdoc
doc
qdoc-manual-macros.qdoc
Generated on
for Qt by
1.16.1