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, so you usually
349 need to use conditional text to get good results also for the offline help.
350
351 For example, to show instructions for the CMake and qmake build systems in
352 tabs:
353
354 \badcode
355 \if defined(onlinedocs)
356 \tab {build-qt-app}{tab-cmake}{CMake}{checked}
357 \tab {build-qt-app}{tab-qmake}{qmake}{}
358 \tabcontent {tab-cmake}
359 \else
360 \section1 Using CMake
361 \endif
362 CMake-specific instructions go here
363 \if defined(onlinedocs)
364 \endtabcontent
365 \tabcontent {tab-qmake}
366 \else
367 \section1 Using qmake
368 \endif
369 qmake-specific instructions go here
370 \if defined(onlinedocs)
371 \endtabcontent
372 \endif
373 \endcode
374
375 \target tab-macro
376 \section1 \\tab
377
378 \badcode
379 \tab {name}{tab-id}{title}{checked}
380 \endcode
381
382 Specifies a tab in a tab group with a name, ID, title, and default state.
383
384 Use a unique \e {name} to specify which tabs belong to a tab group. That is,
385 all tabs in a group have the same name. To separate the tabs from each other,
386 give them each a unique \e {tab-id} within the group. Use this \e {tab-id}
387 as the value of the \\tabcontent macro to add content to the tab.
388
389 The \e {checked} argument selects the tab by default when the HTML page is
390 loaded. For the initially hidden tabs, pass an empty argument {}.
391
392 \target tabcontent-macro
393 \section1 \\tabcontent
394
395 \badcode
396 \tabcontent {tab-id}
397 \endcode
398
399 Adds content to the tab with the \e {tab-id} you specify.
400
401 \target endtabcontent-macro
402 \section1 \\endtabcontent
403
404 Marks the end of the tab content that you begin with \\tabcontent.
405
406 \sa {Macros}
407*/
408
409/*!
410 \page qdoc-macros-youtube-videos.html
411 \previouspage qdoc-macros-tabbed-content.html
412 \nextpage qdoc-macros-misc.html
413
414 \target youtube-macro
415 \title \\youtube
416
417 When generating online documentation, embeds a YouTube video in the HTML.
418 When generating offline documentation (.qch), adds an external link to the
419 video with a thumbnail image. The HTML docs show a thumbnail of the video
420 with a play button. You need to save the thumbnail in
421 \c {\images\extraimages\} in your project folder.
422
423 Use the following URL to open the thumbnail image in a browser:
424 \c {https://img.youtube.com/vi/<ID>/0.jpg}. The \c <ID> is the ID of
425 the video on YouTube. For example, if the URL to the video is
426 \c {https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=youtu.be},
427 the ID is \c dQw4w9WgXcQ. Save the image file as \c dQw4w9WgXcQ.jpg.
428
429 You must add the filename of the thumbnail file to
430 \c {\images\extraimages\extraimages.qdocconf}. For example:
431
432 \badcode
433 {HTML.extraimages,qhp.qtdesignstudio.extraFiles} += \
434 images/dQw4w9WgXcQ.jpg
435 \endcode
436
437 To add a link to the video in text, write:
438
439 \badcode
440 \youtube dQw4w9WgXcQ
441 \endcode
442
443 \sa {Macros}
444*/
445
446/*!
447 \page qdoc-macros-misc.html
448 \previouspage qdoc-macros-youtube-videos.html
449 \nextpage 21-0-qdoc-configuration.html
450
451 \title Miscellaneous Macros
452
453 You can use the following macros to affect the HTML output and to use
454 standard terminology:
455
456 \list
457 \li \l {borderedimage-macro}{\\borderedimage}
458 \li \l {examplecategory-macro}{\\examplecategory}
459 \li \l {key-macro}{\\key}
460 \li \l {nullptr-macro}{\\nullptr}
461 \li \l {summary-macro}{\\summary}
462 \endlist
463
464 \target borderedimage-macro
465 \section1 \\borderedimage
466
467 Like \l{image-command}{\\image}, but adds a border around the image.
468
469 \target examplecategory-macro
470 \section1 \\examplecategory
471
472 Describes the category an example is sorted to in the Qt Creator
473 \uicontrol Examples tab.
474
475 \target key-macro
476 \section1 \\key
477
478 Formats keyboard key names.
479
480 \target nullptr-macro
481 \section1 \\nullptr
482
483 Expands to the term to use for null pointers.
484
485 \target summary-macro
486 \section1 \\summary
487
488 Like \l{brief-command}{\\brief}, but replicates the sentence also as text.
489
490 Wrap the entire sentence within \c {{}}. For example:
491
492 \badcode
493 \summary {Creates a build target.}
494 \endcode
495
496 \sa {macro-variable}{macro}, {Macros}
497*/