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 \\B2QST
203
\li Boot to Qt Startup Screen
204
\row
205
\li \\IFW
206
\li Qt Installer Framework
207
\row
208
\li \\macos
209
\li macOS
210
\row
211
\li \\QA
212
\li Qt Assistant
213
\row
214
\li \\QB
215
\li Qt Bridge
216
\row
217
\li \\QBF
218
\li Qt Bridge for Figma
219
\row
220
\li \\QBPS
221
\li Qt Bridge for Adobe Photoshop
222
\row
223
\li \\QBSK
224
\li Qt Bridge for Sketch
225
\row
226
\li \\QBXD
227
\li Qt Bridge for Adobe XD
228
\row
229
\li \\QC
230
\li Qt Creator
231
\row
232
\li \\QD
233
\li Qt Widgets Designer
234
\row
235
\li \\QDS
236
\li Qt Design Studio
237
\row
238
\li \\QDV
239
\li Qt Design Viewer
240
\row
241
\li \\QfP
242
\li Qt for Python
243
\row
244
\li \\QL
245
\li Qt Linguist
246
\row
247
\li \\QMCU
248
\li Qt for MCUs
249
\row
250
\li \\QMLLS
251
\li QML Language Server
252
\row
253
\li \\QMLP
254
\li QML Profiler
255
\row
256
\li \\QMT
257
\li Qt Maintenance Tool
258
\row
259
\li \\QOI
260
\li Qt Online Installer
261
\row
262
\li \\QQEM
263
\li Qt Quick Effect Maker
264
\row
265
\li \\QQV
266
\li Qt QML Viewer
267
\row
268
\li \\QtAA
269
\li Qt for Android Automotive
270
\row
271
\li \\QtTAS
272
\li Qt Tools for Android Studio
273
\row
274
\li \\QUL
275
\li Qt Quick Ultralite
276
\endtable
277
278
\sa {macro-variable}{macro}, {Macros}
279
*/
280
281
/*!
282
\page qdoc-macros-product-versions.html
283
\previouspage qdoc-macros-product-names.html
284
\nextpage qdoc-macros-tabbed-content.html
285
286
\title Product Versions
287
288
Use the following macros to display version and status information about a
289
topic:
290
291
\table
292
\header
293
\li Macro
294
\li Expands To
295
\row
296
\li \\QtMajorVersion
297
\li The major version number based on the $QT_VER environment variable
298
\row
299
\li \\QtMinorVersion
300
\li The minor version number based on the $QT_VER environment variable
301
\row
302
\li \\QtVersion
303
\li The value of the $QT_VERSION environment variable
304
\row
305
\li \\QtVer
306
\li The value of the $QT_VER environment variable
307
\row
308
\li \\techpreview
309
\li The statement that a module or class is preliminary and might change
310
\endtable
311
312
\section1 \\techpreview
313
314
Appends the tech preview link to the brief sentence and adds the topic to
315
the \c tech_preview group.
316
317
Must be placed directly under a \brief command.
318
319
\sa {macro-variable}{macro}, {Macros}
320
*/
321
322
/*!
323
\page qdoc-macros-tabbed-content.html
324
\previouspage qdoc-macros-formatting.html
325
\nextpage qdoc-macros-youtube-videos.html
326
327
\title Tabbed Content
328
329
Use the following macros to create \e {tab groups} of labeled HTML tabs that
330
have comparable or alternative content. For example, you can show code
331
snippets for different programming languages.
332
333
\list
334
\li \l{tab-macro}{\\tab}
335
\li \l{tabcontent-macro}{\\tabcontent}
336
\li \l{endtabcontent-macro}{\\endtabcontent}
337
\endlist
338
339
\section1 Using Tab Macros
340
341
\badcode
342
\tab {name}{tab-id}{title}{checked}
343
\tabcontent {tab-id}
344
content
345
\endtabcontent
346
\endcode
347
348
\note These macros only work with the online template and DocBook, so you
349
usually need to use conditional text to get good results also for the
350
offline help.
351
352
For example, to show instructions for the CMake and qmake build systems in
353
tabs:
354
355
\badcode
356
\if defined(onlinedocs)
357
\tab {build-qt-app}{tab-cmake}{CMake}{checked}
358
\tab {build-qt-app}{tab-qmake}{qmake}{}
359
\tabcontent {tab-cmake}
360
\else
361
\section1 Using CMake
362
\endif
363
CMake-specific instructions go here
364
\if defined(onlinedocs)
365
\endtabcontent
366
\tabcontent {tab-qmake}
367
\else
368
\section1 Using qmake
369
\endif
370
qmake-specific instructions go here
371
\if defined(onlinedocs)
372
\endtabcontent
373
\endif
374
\endcode
375
376
\target tab-macro
377
\section1 \\tab
378
379
\badcode
380
\tab {name}{tab-id}{title}{checked}
381
\endcode
382
383
Specifies a tab in a tab group with a name, ID, title, and default state.
384
385
Use a unique \e {name} to specify which tabs belong to a tab group. That is,
386
all tabs in a group have the same name. To separate the tabs from each other,
387
give them each a unique \e {tab-id} within the group. Use this \e {tab-id}
388
as the value of the \\tabcontent macro to add content to the tab.
389
390
The \e {checked} argument selects the tab by default when the HTML page is
391
loaded. For the initially hidden tabs, pass an empty argument {}.
392
393
\target tabcontent-macro
394
\section1 \\tabcontent
395
396
\badcode
397
\tabcontent {tab-id}
398
\endcode
399
400
Adds content to the tab with the \e {tab-id} you specify.
401
402
\target endtabcontent-macro
403
\section1 \\endtabcontent
404
405
Marks the end of the tab content that you begin with \\tabcontent.
406
407
\sa {Macros}
408
*/
409
410
/*!
411
\page qdoc-macros-youtube-videos.html
412
\previouspage qdoc-macros-tabbed-content.html
413
\nextpage qdoc-macros-misc.html
414
415
\target youtube-macro
416
\title \\youtube
417
418
When generating online documentation, embeds a YouTube video in the HTML.
419
When generating offline documentation (.qch), adds an external link to the
420
video with a thumbnail image. The HTML docs show a thumbnail of the video
421
with a play button. You need to save the thumbnail in
422
\c {\images\extraimages\} in your project folder.
423
424
Use the following URL to open the thumbnail image in a browser:
425
\c {https://img.youtube.com/vi/<ID>/0.jpg}. The \c <ID> is the ID of
426
the video on YouTube. For example, if the URL to the video is
427
\c {https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=youtu.be},
428
the ID is \c dQw4w9WgXcQ. Save the image file as \c dQw4w9WgXcQ.jpg.
429
430
You must add the filename of the thumbnail file to
431
\c {\images\extraimages\extraimages.qdocconf}. For example:
432
433
\badcode
434
{HTML.extraimages,qhp.qtdesignstudio.extraFiles} += \
435
images/dQw4w9WgXcQ.jpg
436
\endcode
437
438
To add a link to the video in text, write:
439
440
\badcode
441
\youtube dQw4w9WgXcQ
442
\endcode
443
444
\sa {Macros}
445
*/
446
447
/*!
448
\page qdoc-macros-misc.html
449
\previouspage qdoc-macros-youtube-videos.html
450
\nextpage 21-0-qdoc-configuration.html
451
452
\title Miscellaneous Macros
453
454
You can use the following macros to affect the HTML output and to use
455
standard terminology:
456
457
\list
458
\li \l {borderedimage-macro}{\\borderedimage}
459
\li \l {examplecategory-macro}{\\examplecategory}
460
\li \l {key-macro}{\\key}
461
\li \l {nullptr-macro}{\\nullptr}
462
\li \l {summary-macro}{\\summary}
463
\endlist
464
465
\target borderedimage-macro
466
\section1 \\borderedimage
467
468
Like \l{image-command}{\\image}, but adds a border around the image.
469
470
\target examplecategory-macro
471
\section1 \\examplecategory
472
473
Describes the category an example is sorted to in the Qt Creator
474
\uicontrol Examples tab.
475
476
\target key-macro
477
\section1 \\key
478
479
Formats keyboard key names.
480
481
\target nullptr-macro
482
\section1 \\nullptr
483
484
Expands to the term to use for null pointers.
485
486
\target summary-macro
487
\section1 \\summary
488
489
Like \l{brief-command}{\\brief}, but replicates the sentence also as text.
490
491
Wrap the entire sentence within \c {{}}. For example:
492
493
\badcode
494
\summary {Creates a build target.}
495
\endcode
496
497
\sa {macro-variable}{macro}, {Macros}
498
*/
qttools
src
qdoc
qdoc
doc
qdoc-manual-macros.qdoc
Generated on
for Qt by
1.14.0