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-markupcmds.qdoc
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5 \page 03-qdoc-commands-markup.html
6 \previouspage Naming Things
7 \nextpage Macros
8
9 \title Markup Commands
10
11 The markup commands indicate the generated documentation's visual
12 appearance and logical structure.
13
14 \list
15 \li \l {a-command} {\\a}
16 \li \l {annotatedlist-command} {\\annotatedlist}
17 \li \l {b-command} {\\b}
18 \li \l {badcode-command} {\\badcode}
19 \li \l {b-command} {\\bold} (deprecated, use \\b)
20 \li \l {br-command} {\\br}
21 \li \l {brief-command} {\\brief}
22 \li \l {c-command} {\\c}
23 \li \l {caption-command} {\\caption}
24 \li \l {code-command} {\\code}
25 \li \l {codeline-command} {\\codeline}
26 \li \l {details-command} {\\details}
27 \li \l {div-command} {\\div}
28 \li \l {dots-command} {\\dots}
29 \li \l {e-command} {\\e}
30 \li \l {else-command} {\\else}
31 \li \l {endif-command} {\\endif}
32 \li \l {generatelist-command} {\\generatelist}
33 \li \l {header-command} {\\header}
34 \li \l {e-command} {\\i} (deprecated, use \\e)
35 \li \l {if-command} {\\if}
36 \li \l {image-command} {\\image}
37 \li \l {include-command} {\\include}
38 \li \l {inlineimage-command} {\\inlineimage}
39 \li \l {keyword-command} {\\keyword}
40 \li \l {l-command} {\\l}
41 \li \l {legalese-command} {\\legalese}
42 \li \l {li-command} {\\li}
43 \li \l {list-command} {\\list}
44 \li \l {meta-command} {\\meta}
45 \li \l {noautolist-command} {\\noautolist}
46 \li \l {li-command} {\\o} (deprecated, use \\li)
47 \li \l {note-command} {\\note}
48 \li \l {notranslate-command} {\\notranslate}
49 \li \l {omit-command} {\\omit}
50 \li \l {printline-command} {\\printline}
51 \li \l {printto-command} {\\printto}
52 \li \l {printuntil-command} {\\printuntil}
53 \li \l {qml-command}{\\qml}
54 \li \l {quotation-command} {\\quotation}
55 \li \l {quotefile-command} {\\quotefile}
56 \li \l {quotefromfile-command} {\\quotefromfile}
57 \li \l {raw-command} {\\raw}
58 \li \l {row-command} {\\row}
59 \li \l {sa-command} {\\sa}
60 \li \l {sectionOne-command} {\\section1}
61 \li \l {sectionTwo-command} {\\section2}
62 \li \l {sectionThree-command} {\\section3}
63 \li \l {sectionFour-command} {\\section4}
64 \li \l {sincelist-command} {\\sincelist}
65 \li \l {skipline-command} {\\skipline}
66 \li \l {skipto-command} {\\skipto}
67 \li \l {skipuntil-command} {\\skipuntil}
68 \li \l {snippet-command} {\\snippet}
69 \li \l {span-command} {\\span}
70 \li \l {sub-command} {\\sub}
71 \li \l {sup-command} {\\sup}
72 \li \l {table-command} {\\table}
73 \li \l {target-command} {\\target}
74 \li \qdoccmd tm
75 \li \l {tt-command} {\\tt}
76 \li \l {uicontrol-command} {\\uicontrol}
77 \li \l {underline-command} {\\underline}
78 \li \l {raw-command} {\\unicode}
79 \li \l {warning-command} {\\warning}
80 \li \l {backslash-sequence} {\\\\}
81 \li \l {endash-sequence} {\--}
82 \li \l {emdash-sequence} {-\--}
83 \endlist
84*/
85
86
87/*!
88 \page 04-qdoc-commands-textmarkup.html
89 \previouspage Markup Commands
90 \nextpage Document Structure
91
92 \title Text Markup
93
94 The text formatting commands indicate how text is to be rendered.
95
96 \target a-command
97 \section1 \\a (parameter marker)
98
99 The \\a command tells QDoc the next word is a formal parameter name.
100
101 A warning is emitted when a formal parameter is not documented or
102 is misspelled, so when you document a function you should mention
103 each formal parameter by name in the function description,
104 preceded by the \\a command. The parameter name is then rendered
105 in italics.
106
107 The formal parameter name may be enclosed between curly brackets,
108 but that isn't required.
109
110 \target c-command
111 \section1 \\c (code font)
112
113 The \\c command is used for rendering variable names, user-defined
114 class names, and C++ keywords (for example, \c int and \c for) in the code
115 font.
116
117 The command renders its argument using a monospace font. If the text to be
118 rendered in the code font contains spaces, enclose the entire text in curly
119 brackets:
120
121 \code
122 \c {QLineEdit::QLineEdit(const QString &contents, QWidget *parent) : QWidget(parent)}
123 \endcode
124
125 The \\c command accepts the special character \c \ within its
126 argument, which renders it as a normal character. So if you want
127 to use nested commands, you must use the \l {tt-command} {teletype
128 (\\tt)} command instead.
129
130 See also \l {tt-command} {\\tt} and \l {code-command} {\\code}.
131
132 \target details-command
133 \section1 \\details (collapsible)
134
135 The \\details and \\enddetails commands generates a collapsible <details>
136 element with a <summary> to control the hidden/visible state.
137
138 When generating HTML output, use the \\details and \\enddetails commands to
139 generate a collapsible \c{<details>} HTML element. The command takes an
140 optional summary string enclosed in curly braces. This optional argument
141 specifies a visible heading for the details.
142
143 For example, with the following input:
144 \badcode *
145 /\1!
146 \details {QDoc details}
147 \note You're looking at detailed information.
148 \enddetails
149 \1/
150 \endcode
151
152 If QDoc is generating HTML, it will translate these commands to:
153
154 \badcode
155 <summary>QDoc details</summary><div class="admonition note"><p><b>Note: </b>You're looking at detailed information.</p></div>
156 \endcode
157
158 QDoc renders this as:
159
160 \details {QDoc details}
161 \note You're looking at detailed information.
162 \enddetails
163
164 For any other output format, QDoc generates the contents as a normal paragraph,
165 ignoring the summary string. This command was introduced to QDoc in Qt6.6.
166
167 \target div-command
168 \section1 \\div
169
170 The \\div and \\enddiv commands delimit a large or small block of
171 text (which may include other QDoc commands) to which special
172 formatting attributes should be applied.
173
174 An argument must be provided in curly braces, as in the QDoc
175 comment shown below. The argument is not interpreted but is used
176 as attribute(s) of the tag that is output by QDoc.
177
178 For example, we might want to render an inline image so that it
179 floats to the right of the current block of text:
180
181 \badcode *
182 /\1!
183 \div {class="float-right"}
184 \inlineimage qml-column.png
185 \enddiv
186 \1/
187 \endcode
188
189 If QDoc is generating HTML, it will translate these commands to:
190
191 \code
192 <div class="float-right"><p><img src="images/qml-column.png" /></p></div>
193 \endcode
194
195 For HTML, the attribute value \e {float-right} then will refer to
196 a clause in the style.css file, which in this case could be:
197
198 \code
199 div.float-right
200 {
201 float: right; margin-left: 2em
202 }
203 \endcode
204
205 \note Note that the \b {\\div} command can be nested.
206
207 Below you can find an example taken from the index.qdoc file used to
208 generate index.html for Qt 4.7:
209
210 \code
211 \div {class="indexbox guide"}
212 \div {class="heading"}
213 Qt Developer Guide
214 \enddiv
215 \div {class="indexboxcont indexboxbar"}
216 \div {class="section indexIcon"} \emptyspan
217 \enddiv
218 \div {class="section"}
219 Qt is a cross-platform application and UI
220 framework. Using Qt, you can write web-enabled
221 applications once and deploy them across desktop,
222 mobile and embedded operating systems without
223 rewriting the source code.
224 \enddiv
225 \div {class="section sectionlist"}
226 \list
227 \li \l{Getting Started}
228 \li \l{Installation} {Installation}
229 \li \l{how-to-learn-qt.html} {How to learn Qt}
230 \li \l{tutorials.html} {Tutorials}
231 \li \l{Qt Examples} {Examples}
232 \li \l{qt4-7-intro.html} {What's new in Qt 4.7}
233 \endlist
234 \enddiv
235 \enddiv
236 \enddiv
237 \endcode
238
239 When all the class attribute values are defined as they are in the
240 style.css file that is used for rendering the Qt documentation,
241 the above example is rendered as:
242
243 \div {class="indexbox guide"}
244 \div {class="heading"}
245 Qt Developer Guide
246 \enddiv
247 \div {class="indexboxcont indexboxbar"}
248 \div {class="section indexIcon"} \emptyspan
249 \enddiv
250 \div {class="section"}
251 Qt is a cross-platform application and UI
252 framework. Using Qt, you can write web-enabled
253 applications once and deploy them across desktop,
254 mobile and embedded operating systems without
255 rewriting the source code.
256 \enddiv
257 \div {class="section sectionlist"}
258 \list
259 \li Getting Started
260 \li Installation
261 \li How to learn Qt
262 \li Tutorials
263 \li Examples
264 \li What's new in Qt 4.7
265 \endlist
266 \enddiv
267 \enddiv
268 \enddiv
269
270 See also \l {span-command} {\\span}.
271
272 \target span-command
273 \section1 \\span
274
275 The \\span command applies special formatting to a small block of text.
276
277 Two arguments must be provided, each argument in curly braces, as
278 shown in the QDoc comment below. The first argument is not
279 interpreted, but specifies the formatting attribute(s) of the tag
280 output by QDoc. The second argument is the text to be rendered with
281 the special formatting attributes.
282
283 For example, we might want to render the first word of each
284 element in a numeric list in blue.
285
286 \badcode *
287 /\1!
288 Global variables with complex types:
289 \list 1
290 \li \span {class="variableName"} {mutableComplex1} in globals.cpp at line 14
291 \li \span {class="variableName"} {mutableComplex2} in globals.cpp at line 15
292 \li \span {class="variableName"} {constComplex1} in globals.cpp at line 16
293 \li \span {class="variableName"} {constComplex2} in globals.cpp at line 17
294 \endlist
295 \1/
296 \endcode
297
298 Class \e {variableName} refers to a clause in your style.css.
299
300 \code
301 .variableName
302 {
303 font-family: courier;
304 color: blue
305 }
306 \endcode
307
308 Using the \e {variableName} clause shown above, the example is rendered as:
309
310 Global variables with complex types:
311 \list 1
312 \li \span {class="variableName"} {mutableComplex1} in globals.cpp at line 14
313 \li \span {class="variableName"} {mutableComplex2} in globals.cpp at line 15
314 \li \span {class="variableName"} {constComplex1} in globals.cpp at line 16
315 \li \span {class="variableName"} {constComplex2} in globals.cpp at line 17
316 \endlist
317
318 \note The \b span command does not cause a new paragraph to be
319 started.
320
321 See also \l {div-command} {\\div}.
322
323 \target tm-command
324 \section1 \\tm (trademark)
325
326 The \\tm command indicates that its argument is a trademark. QDoc appends
327 a trademark symbol `™` to the first occurrence of the argument when
328 generating a page.
329
330 In the project's configuration, the \c navigation.trademarkspage variable
331 is used for defining a title of a page that contains trademark-related
332 documentation.
333
334 \badcode
335 navigation.trademarkspage = Trademarks
336 \endcode
337
338 If set, each occurrence of the trademark symbol also links to the
339 trademarks page.
340
341 \note In section titles, the \\tm command is ignored and its argument
342 rendered as-is.
343
344 See also \l {sectionOne-command}{\\section1} and \qdocvar {navigation}.
345
346 \target tt-command
347 \section1 \\tt (teletype font)
348
349 The \\tt command renders its argument in a monospace font. This
350 command behaves just like the \l {c-command} {\\c} command, except
351 that \\tt allows you to nest QDoc commands within the argument
352 (e.g. \l {e-command} {\\e}, \l {b-command} {\\b} and \l
353 {underline-command} {\\underline}).
354
355 \badcode *
356 /\1!
357 After having populated the main container with
358 child widgets, \c setupUi() scans the main container's list of
359 slots for names with the form
360 \tt{on_\e{objectName}_\e{signalName}().}
361 \1/
362 \endcode
363
364 If the text to be rendered in the code font contains spaces, enclose the
365 entire text in curly brackets.
366
367 \code
368 \tt {QLineEdit::QLineEdit(const QString &contents, QWidget *parent) :QWidget(parent)}
369 \endcode
370
371 See also \l {c-command} {\\c}.
372
373 \target b-command
374 \section1 \\b
375
376 The \\b command renders its argument in bold font. This command used
377 to be called \\bold.
378
379 \badcode *
380 /\1!
381 This is regular text; \b {this text is
382 rendered using the \\b command}.
383 \1/
384 \endcode
385
386 \target br-command
387 \section1 \\br
388
389 The \\br command forces a line break.
390
391 \target e-command
392 \section1 \\e (emphasis, italics)
393
394 The \\e command renders its argument in a special font, normally italics. This
395 command used to be called \\i, which is now deprecated.
396
397 If the argument contains spaces or other punctuation, enclose the
398 argument in curly brackets.
399
400 \badcode *
401 /\1!
402 Here, we render \e {a few words} in italics.
403 \1/
404 \endcode
405
406 If you want to use other QDoc commands within an argument that
407 contains spaces, you always need to enclose the argument in
408 braces. But QDoc is smart enough to count parentheses, so you
409 don't need braces in cases like this:
410
411 \badcode *
412 /\1!
413 An argument can sometimes contain whitespaces,
414 for example: \e QPushButton(tr("A Brand New Button"))
415 \1/
416 \endcode
417
418 Finally, trailing punctuation is not included in an argument,
419 nor is "'s".
420
421 \target sub-command
422 \section1 \\sub
423
424 The \\sub command renders its argument lower than the baseline of
425 the regular text, using a smaller font.
426
427 \badcode *
428 /\1!
429 Definition (Range): Consider the sequence
430 {x\sub n}\sub {n > 1} . The set
431
432 {x\sub 2, x\sub 3, x\sub 4, ...} = {x\sub n ; n = 2, 3, 4, ...}
433
434 is called the range of the sequence.
435 \1/
436 \endcode
437
438 If the argument contains spaces or other punctuation, enclose the
439 argument in curly brackets.
440
441 \target sup-command
442 \section1 \\sup
443
444 The \\sup command renders its argument higher than
445 the baseline of the regular text, using a smaller font.
446
447 \badcode *
448 /\1!
449 The series
450
451 1 + a + a\sup 2 + a\sup 3 + a\sup 4 + ...
452
453 is called the \i {geometric series}.
454 \1/
455 \endcode
456
457 If the argument contains spaces or other punctuation, enclose the
458 argument in curly brackets.
459
460 \target uicontrol-command
461 \section1 \\uicontrol
462
463 The \\uicontrol command is used to mark content as being used for UI
464 control elements. When using HTML, the output is rendered in bold.
465
466 See also \l {b-command}{\\b}.
467
468 \target underline-command
469 \section1 \\underline
470
471 The \\underline command renders its argument underlined.
472
473 \badcode *
474 /\1!
475 The \underline {F}ile menu gives the users the possibility
476 to edit an existing file, or save a new or modified
477 file, and exit the application.
478 \1/
479 \endcode
480
481 If the argument contains spaces or other punctuation, enclose the
482 argument in curly brackets.
483
484 \target backslash-sequence
485 \section1 \\\\ (double backslash)
486
487 The sequence \\\\ expands to a single backslash.
488
489 QDoc commands always start with a single backslash. To display a
490 single backslash in the text, you must type two backslashes. If
491 you want to display two backslashes, you must type four.
492
493 \badcode *
494 /\1!
495 The \\\\ command is useful if you want a
496 backslash to appear verbatim, for example,
497 writing C:\\windows\\home\\.
498 \1/
499 \endcode
500
501 However, if you want your text to appear in a monospace font as
502 well, you can use the \l {c-command} {\\c} command instead, which
503 accepts and renders the backslash as any other character. For
504 example:
505
506 \badcode *
507 /\1!
508 The \\c command is useful if you want a
509 backslash to appear verbatim, and the word
510 that contains it written in a monospace font,
511 like this: \c {C:\windows\home\}.
512 \1/
513 \endcode
514
515 \target endash-sequence
516 \section1 \-- (en dash)
517 QDoc renders double hyphens as an en dash. QDoc markup commands
518 designed to make their input appear verbatim---such as the \\c
519 command---won't replace the double hyphens with an en dash character.
520 For example:
521
522 \badcode *
523 /\1!
524 The \\c command -- useful if you want text in a monospace font --
525 is well documented.
526 \1/
527 \endcode
528
529 However, other commands may require that the hyphens are escaped to ensure
530 QDoc renders the output as expected. For example;
531
532 \badcode *
533 /\1!
534 This \l {endash-sequence}{link to the -- (endash) sequence}
535 isn't escaped and QDoc therefore renders an endash in the link
536 text. However, the escaped
537 \l {endash-sequence}{link to the \-- (endash) sequence}
538 renders both hyphens as intended.
539 \1/
540 \endcode
541
542 \warning Avoid using en dash in section and page titles. Linking to a title
543 may fail if it contains special characters such as an en dash.
544
545 See also \l {emdash-sequence}{\-\-- (em dash)}.
546
547 \target emdash-sequence
548 \section1 -\-- (em dash)
549
550 QDoc renders triple hyphens as an em dash. QDoc markup commands
551 designed to make their input appear verbatim---such as the \\c
552 command---won't replace the triple hyphens with an em dash character.
553 For example:
554
555 \badcode *
556 /\1!
557 The \\c command---useful when you want text to be rendered
558 verbatim---is well documented.
559 \1/
560 \endcode
561
562 However, other commands may require that the hyphens are escaped to ensure
563 QDoc renders the output as expected. For example;
564
565 \badcode *
566 /\1!
567 This \l {emdash-sequence}{link to the --- (emdash) sequence}
568 isn't escaped and QDoc therefore renders an emdash in the link
569 text. However, the escaped
570 \l {emdash-sequence}{link to the -\-- (emdash) sequence}
571 renders both hyphens as intended.
572 \1/
573 \endcode
574
575 \note The escaped control sequence in this example is for the en dash.
576 This avoids a hyphen followed by an en dash in the output.
577
578 \warning Avoid using em dash in section and page titles. Linking to a title
579 may fail if it contains special characters such as an em dash.
580
581 See also \l {endash-sequence}{\-- (en dash)}.
582*/
583
584
585/*!
586 \page 05-qdoc-commands-documentstructure.html
587 \previouspage Text Markup
588 \nextpage Including Code Inline
589
590 \title Document Structure
591
592 The document structuring commands are for dividing your document
593 into sections. QDoc supports four levels of section: \c \section1,
594 \c \section2, \c \section3, and \c \section4. The section commands
595 correspond to the traditional section, subsection, etc used in
596 outlining.
597
598 \section1 Section commands
599
600 In general a document structuring command considers everything
601 that follows it until the first line break as its argument. The
602 argument is rendered as the unit's title. If the title needs to be
603 spanned over several lines, make sure that each line (except the
604 last one) is ended with a backslash.
605
606 In total, there are four levels for sections in QDoc: \c \section1,
607 \c \section2, \c \section3 and \c \section4. These correspond to the
608 traditional section, subsection, subsubsection and subsubsubsection.
609
610 There is a strict ordering of the section units:
611
612 \code
613 section1
614 |
615 section2
616 |
617 section3
618 |
619 section4
620 \endcode
621
622 When sections are used, the first section command should be \c section1.
623
624 \badcode *
625 /\1!
626 \section1 Basic Qt
627
628 This is the first section.
629
630
631 \section2 Getting Started
632
633 This is the first subsection.
634
635
636 \section3 Hello Qt
637
638 This is the first subsubsection.
639
640
641 \section3 Making Connections
642
643 This is the second subsubsection.
644
645
646 \section3 Using the Reference Documentation
647
648 This is the third subsubsection.
649
650
651 \section2 Creating Dialogs
652
653 This is the second subsection.
654
655
656 \section3 Subclassing QDialog
657
658 This is the first subsubsection.
659
660 ...
661
662
663 \section1 Intermediate Qt
664
665 This is the second section.
666
667
668 \section2 Layout Management
669
670 This is the second section's first subsection.
671
672
673 \section3 Basic Layouts
674
675 This is the first subsubsection.
676
677 ...
678 \1/
679 \endcode
680
681 Each section is a logical unit in the document. The section
682 heading appears in the automatically generated table of contents
683 that normally appears in the upper right-hand corner of the page.
684
685 \target sectionOne-command
686 \section1 \\section1
687
688 The \\section1 command starts a new section.
689
690 See \l{section-commands} {Section commands} for an explanation of the various
691 section units, command argument, and rendering.
692
693 \target sectionTwo-command
694 \section1 \\section2
695
696 The \\section2 command starts a new section.
697
698 See \l{section-commands} {Section commands} for an explanation of the various
699 section units, command argument, and rendering.
700
701 \target sectionThree-command
702 \section1 \\section3
703
704 The \\section3 command starts a new section.
705
706 See \l{section-commands} {Section commands} for an explanation of the various
707 section units, command argument, and rendering.
708
709 \target sectionFour-command
710 \section1 \\section4
711
712 The \\section4 command starts a new section.
713
714 See \l{section-commands} {Section commands} for an explanation of the various
715 section units, command argument, and rendering.
716
717*/
718
719
720/*!
721 \page 06-qdoc-commands-includecodeinline.html
722 \previouspage Document Structure
723 \nextpage Including External Code
724
725 \title Including Code Inline
726
727 The following commands are used to render source code without
728 formatting. The source code begins on a new line, rendered in the
729 code.
730
731 \note Although most of these commands are for rendering C++
732 code, the
733 \l{07-0-qdoc-commands-includingexternalcode.html#snippet-command}
734 {\\snippet} and
735 \l{07-0-qdoc-commands-includingexternalcode.html#codeline-command}
736 {\\codeline} commands are preferred over the others. These
737 commands allow equivalent code snippets for other Qt language
738 bindings to be substituted for the C++ snippets in the
739 documentation.
740
741 \target code-command
742 \section1 \\code
743
744 The \\code and \\endcode commands enclose a snippet of source code.
745
746 \note The \l {c-command} {\\c} command can be used for short code
747 fragments within a sentence. The \\code command is for longer code
748 snippets. It renders the code verbatim in a separate paragraph in
749 a html <pre> element, and parses the enclosed snippet, creating links
750 to any known types in the code.
751
752 For documenting command-line instructions, shell scripts, or any
753 content that is not in a Qt language recognized by QDoc, use
754 \l {badcode-command}{\\badcode} instead.
755
756 When processing the \\code command, QDoc removes all indentation
757 that is common for the verbatim code blocks within a \c{/}\c{*!}
758 ... \c{*}\c{/} comment before it adds the standard indentation.
759
760 \note This doesn't apply to externally quoted code using the \l
761 {quotefromfile-command} {\\quotefromfile} or \l
762 {quotefile-command} {\\quotefile} command.
763
764 \code [text] \\endcode *
765 /*!
766 \code
767 #include <QApplication>
768 #include <QPushButton>
769
770 int main(int argc, char *argv[])
771 {
772 ...
773 }
774 \1
775 \2/
776 \endcode
777
778 Other QDoc commands are disabled within \\code... \\endcode, and
779 the special character '\\' is accepted and rendered like the rest
780 of the code, unless it is followed by a digit and parameters were
781 passed to \\code.
782
783 \section2 Highlighting and autolinking
784
785 The \\code commands attempts to parse its contents as code of a
786 specific language, as defined in the \l {language-variable}{language}
787 configuration variable. This provides highlighting and automatic
788 linking to types detected in the code.
789
790 As an exception since QDoc version 6.4, when the \\code command
791 is used within a QML-specific \l {Topic Commands}{topic}, QDoc
792 first attempts to recognize the code as QML; for other topics,
793 the language configuration variable takes precedence. To
794 explicitly mark the code snippet as QML, use the \l {qml-command}
795 {\\qml} command instead.
796
797 From version 6.11, a language can be specified as an optional
798 case-insensitive argument on the same line as the \\code command.
799 When specified, the language overrides the default language and any
800 other language-specific behavior described above. QDoc also defines
801 the \c text language so that blocks of code can be displayed
802 without any markup or highlighting.
803
804 For example:
805
806 \code [text] \\endcode
807 \code [text]
808 # This is an example of unmarked code.
809 implement MyModule;
810 include "sys.m";
811 sys: Sys;
812 \1
813 \endcode
814
815 This can be useful when quoting a language that QDoc does not have
816 a marker for.
817
818 \section2 Code snippet parameters
819
820 Since QDoc version 5.12, \\code command accepts also optional
821 parameters. Parameters are useful for injecting simple
822 strings into the code snippet. To inject a string to a specific
823 location in the snippet, add a backslash followed by a digit (1..8).
824 The digits correspond with the order of the argument list, where
825 arguments are separated by spaces and follow any optional language
826 argument.
827
828 For example:
829
830 \code [text] 1 2 * endcode
831 /\3!
832 \code * hello
833 /\\1 \\2 \\1/
834 \\4
835 \3/
836 \endcode
837
838 For the above snippet, QDoc renders the word \e hello enclosed in
839 a C-style comment.
840
841 \section2 Including code from external files
842
843 To include code snippets from an external file, use the
844 \l{snippet-command}{\\snippet} and \l{codeline-command}
845 {\\codeline} commands.
846
847 See also \l {c-command}{\\c}, \l {qml-command}{\\qml},
848 \l {badcode-command}{\\badcode}, \l {quotefromfile-command}
849 {\\quotefromfile}, and \l {language-variable}{language}.
850
851 \target badcode-command
852 \section1 \\badcode
853
854 Similar to \l {code-command}{\\code}, \\badcode and \\endcode commands
855 enclose content that is rendered verbatim in a separate paragraph, but no
856 parsing or automatic link creation is performed. Instead, the content is
857 treated as plain text.
858
859 Substitute \\code with this command when documenting command-line
860 instructions, shell scripts or any other content that is not in a Qt
861 language, but should still be styled similarly to a \\code paragraph.
862
863 Like \\code, \\badcode accepts also optional parameters.
864
865 \target qml-command
866 \section1 \\qml
867
868 The \\qml and \\endqml commands enclose a snippet of QML source
869 code. Use these for proper syntax highlighting of QML code snippets.
870 The enclosed snippet must be complete as if it was a valid .qml file.
871 If the snippet is incomplete, QDoc will issue a warning and ignore the
872 snippet.
873
874 \badcode *
875 /\1!
876 \qml
877 import QtQuick 2.0
878
879 Row {
880 Rectangle {
881 width: 100; height: 100
882 color: "blue"
883 transform: Translate { y: 20 }
884 }
885 Rectangle {
886 width: 100; height: 100
887 color: "red"
888 transform: Translate { y: -20 }
889 }
890 }
891 \endqml
892 \1/
893 \endcode
894
895 Like the \l{code-command}{\\code} command, \\qml accepts optional
896 parameters.
897*/
898
899
900/*!
901 \page 07-0-qdoc-commands-includingexternalcode.html
902 \previouspage Including Code Inline
903 \nextpage Creating Links
904
905 \title Including External Code
906
907 The following commands enable you to include code snippets from
908 external files. You can make QDoc include the complete contents of
909 a file, or you can quote specific parts of the file and skip
910 others. The typical use of the latter is to quote a file chunk by
911 chunk.
912
913 \note Although all these commands can be used for rendering C++
914 code, the
915 \l{07-0-qdoc-commands-includingexternalcode.html#snippet-command}
916 {\\snippet} and
917 \l{07-0-qdoc-commands-includingexternalcode.html#codeline-command}
918 {\\codeline} commands are preferred over the others. These
919 commands allow equivalent code snippets for other Qt language
920 bindings to be substituted for the C++ snippets in the
921 documentation.
922
923 \target quotefile-command
924 \section1 \\quotefile
925
926 The \\quotefile command expands to the complete contents of the
927 file given as argument.
928
929 The command considers the rest of the line as part of its
930 argument, make sure to follow the file name with a line break.
931
932 The file's contents is rendered in a separate paragraph, using a
933 monospace font and the standard indentation. The code is shown
934 verbatim.
935
936 \badcode *
937 /\1!
938 This is a simple "Hello world" example:
939
940 \quotefile examples/main.cpp
941
942 It contains only the bare minimum you need
943 to get a Qt application up and running.
944 \1/
945 \endcode
946
947 See also \l {quotefromfile-command} {\\quotefromfile} and
948 \l {code-command} {\\code}.
949
950
951 \target quotefromfile-command
952 \section1 \\quotefromfile
953
954 The \\quotefromfile command opens the file given as argument for
955 quoting.
956
957 The command considers the rest of the line as part of its
958 argument, make sure to follow the file name with a line break.
959
960 The command is intended for use when quoting parts from file with
961 the walkthrough commands: \l {printline-command} {\\printline}, \l
962 {printto-command} {\\printto}, \l {printuntil-command}
963 {\\printuntil}, \l {skipline-command} {\\skipline}, \l
964 {skipto-command} {\\skipto}, \l {skipuntil-command}
965 {\\skipuntil}. This enables you to quote specific portions of a
966 file.
967
968 \badcode *
969 /\1!
970 The whole application is contained within
971 the \c main() function:
972
973 \quotefromfile examples/main.cpp
974
975 \skipto main
976 \printuntil app(argc, argv)
977
978 First we create a QApplication object using
979 the \c argc and \c argv parameters.
980
981 \skipto QPushButton
982 \printuntil resize
983
984 Then we create a QPushButton, and give it a reasonable
985 size using the QWidget::resize() function.
986
987 ...
988 \1/
989 \endcode
990
991 QDoc remembers which file it is quoting from, and the current
992 position in that file (see \l {file} {\\printline} for more
993 information). There is no need to "close" the file.
994
995 See also \l {quotefile-command} {\\quotefile}, \l {code-command}
996 {\\code} and \l {dots} {\\dots}.
997
998 \target printline-command
999 \section1 \\printline
1000
1001 The \\printline command expands to the line from the current
1002 position.
1003
1004 To ensure that the documentation remains synchronized with the
1005 source file, a substring of the line must be specified as an
1006 argument to the command. Note that the command considers the rest
1007 of the line as part of its argument, make sure to follow the
1008 substring with a line break.
1009
1010 The line from the source file is rendered as a separate paragraph,
1011 using a monospace font and the standard indentation. The code is
1012 shown verbatim.
1013
1014 \badcode *
1015 /\1!
1016 There has to be exactly one QApplication object
1017 in every GUI application that uses Qt.
1018
1019 \quotefromfile examples/main.cpp
1020
1021 \printline QApplication
1022
1023 This line includes the QApplication class
1024 definition. QApplication manages various
1025 application-wide resources, such as the
1026 default font and cursor.
1027
1028 \printline QPushButton
1029
1030 This line includes the QPushButton class
1031 definition. The QPushButton widget provides a command
1032 button.
1033
1034 \printline main
1035
1036 The main function...
1037 \1/
1038 \endcode
1039
1040 \target file
1041
1042 QDoc reads the file sequentially. To move the current position
1043 forward you can use either of the \l {skipline-command}
1044 {\\skip...} commands. To move the current position backward, you
1045 can use the \l {quotefromfile-command} {\\quotefromfile} command
1046 again.
1047
1048 \target substring
1049
1050 If the substring argument is surrounded by slashes it is
1051 interpreted as a \l {QRegularExpression}{regular expression}.
1052
1053 \badcode *
1054 /\1!
1055 \quotefromfile examples/mainwindow.cpp
1056
1057 \skipto closeEvent
1058 \printuntil /^\}/
1059
1060 Close events are sent to widgets that the users want to
1061 close, usually by clicking \c File|Exit or by clicking
1062 the \c X title bar button. By reimplementing the event
1063 handler, we can intercept attempts to close the
1064 application.
1065 \1/
1066 \endcode
1067
1068 (\l {widgets/scribble} {The complete example file...})
1069
1070 The regular expression \c /^\}/ makes QDoc print until the first
1071 '}' character occurring at the beginning of the line without
1072 indentation. /.../ encloses the regular expression, and '^' means
1073 the beginning of the line. The '}' character must be escaped since
1074 it is a special character in regular expressions.
1075
1076 QDoc will emit a warning if the specified substring or regular
1077 expression cannot be located, i.e. if the source code has changed.
1078
1079 See also \l {printto-command} {\\printto} and \l
1080 {printuntil-command} {\\printuntil}.
1081
1082 \target printto-command
1083 \section1 \\printto
1084
1085 The \\printto command expands to all the lines from the current
1086 position up to and \e excluding the next line containing a given
1087 substring.
1088
1089 The command considers the rest of the line as part of its
1090 argument, make sure to follow the substring with a line break. The
1091 command also follows the same conventions for \l {file}
1092 {positioning} and \l {substring} {argument} as the \l
1093 {printline-command} {\\printline} command.
1094
1095 The lines from the source file are rendered in a separate
1096 paragraph, using a monospace font and the standard
1097 indentation. The code is shown verbatim.
1098
1099 \badcode *
1100 /\1!
1101 The whole application is contained within the
1102 \c main() function:
1103
1104 \quotefromfile examples/main.cpp
1105 \printto hello
1106
1107 First we create a QApplication object using the \c argc and
1108 \c argv parameters...
1109 \1/
1110 \endcode
1111
1112 See also \l {printline-command} {\\printline} and \l
1113 {printuntil-command} {\\printuntil}.
1114
1115 \target printuntil-command
1116 \section1 \\printuntil
1117
1118 The \\printuntil command expands to all the lines from the current
1119 position up to and \e including the next line containing a given
1120 substring.
1121
1122 The command considers the rest of the line as part of its
1123 argument, make sure to follow the substring with a line break. The
1124 command also follows the same conventions for \l {file}
1125 {positioning} and \l {substring} {argument} as the \l
1126 {printline-command} {\\printline} command.
1127
1128 If \\printuntil is used without an argument, it expands to all the
1129 lines from the current position to the end of the quoted file.
1130
1131 The lines from the source file are rendered in a separate
1132 paragraph, using a monospace font and the standard
1133 indentation. The code is shown verbatim.
1134
1135 \badcode *
1136 /\1!
1137 The whole application is contained within the
1138 \c main() function:
1139
1140 \quotefromfile examples/main.cpp
1141 \skipto main
1142 \printuntil hello
1143
1144 First we create a QApplication object using the
1145 \c argc and \c argv parameters, then we create
1146 a QPushButton.
1147 \1/
1148 \endcode
1149
1150 See also \l {printline-command} {\\printline} and \l
1151 {printto-command} {\\printto}.
1152
1153 \target skipline-command
1154 \section1 \\skipline
1155
1156 The \\skipline command ignores the next non-blank line in the
1157 current source file.
1158
1159 Doc reads the file sequentially, and the \\skipline command is
1160 used to move the current position (omitting a line of the source
1161 file). See the remark about \l {file} {file positioning} above.
1162
1163 The command considers the rest of the line as part of its
1164 argument, make sure to follow the substring with a line break. The
1165 command also follows the same conventions for \l {substring}
1166 {argument} as the \l {printline-command} {\\printline} command,
1167 and it is used in conjunction with the \l {quotefromfile-command}
1168 {\\quotefromfile} command.
1169
1170 \badcode *
1171 /\1!
1172 QPushButton is a GUI push button that the user
1173 can press and release.
1174
1175 \quotefromfile examples/main.cpp
1176 \skipline QApplication
1177 \printline QPushButton
1178
1179 This line includes the QPushButton class
1180 definition. For each class that is part of the
1181 public Qt API, there exists a header file of
1182 the same name that contains its definition.
1183 \1/
1184 \endcode
1185
1186
1187 See also \l {skipto-command} {\\skipto}, \l {skipuntil-command}
1188 {\\skipuntil} and \l {dots} {\\dots}.
1189
1190 \target skipto-command
1191 \section1 \\skipto
1192
1193 The \\skipto command ignores all the lines from the current
1194 position up to and \e excluding the next line containing a given
1195 substring.
1196
1197 QDoc reads the file sequentially, and the \\skipto command is used
1198 to move the current position (omitting one or several lines of the
1199 source file). See the remark about \l {file} {file positioning}
1200 above.
1201
1202 The command considers the rest of the line as part of its
1203 argument, make sure to follow the substring with a line break.
1204
1205 The command also follows the same conventions for \l {substring}
1206 {argument} as the \l {printline-command} {\\printline} command,
1207 and it is used in conjunction with the \l {quotefromfile-command}
1208 {\\quotefromfile} command.
1209
1210 \badcode *
1211 /\1!
1212 The whole application is contained within
1213 the \c main() function:
1214
1215 \quotefromfile examples/main.cpp
1216 \skipto main
1217 \printuntil }
1218
1219 First we create a QApplication object. There
1220 has to be exactly one such object in
1221 every GUI application that uses Qt. Then
1222 we create a QPushButton, resize it to a reasonable
1223 size ...
1224 \1/
1225 \endcode
1226
1227 See also \l {skipline-command} {\\skipline}, \l
1228 {skipuntil-command} {\\skipuntil} and \l {dots} {\\dots}.
1229
1230 \target skipuntil-command
1231 \section1 \\skipuntil
1232
1233 The \\skipuntil command ignores all the lines from the current
1234 position up to and \e including the next line containing a given
1235 substring.
1236
1237 QDoc reads the file sequentially, and the \\skipuntil command is
1238 used to move the current position (omitting one or several lines
1239 of the source file). See the remark about \l {file} {file
1240 positioning} above.
1241
1242 The command considers the rest of the line as part of its
1243 argument, make sure to follow the substring with a line break.
1244
1245 The command also follows the same conventions for \l {substring}
1246 {argument} as the \l {printline-command} {\\printline} command,
1247 and it is used in conjunction with the \l {quotefromfile-command}
1248 {\\quotefromfile} command.
1249
1250 \badcode *
1251 /\1!
1252 The first thing we did in the \c main() function
1253 was to create a QApplication object \c app.
1254
1255 \quotefromfile examples/main.cpp
1256 \skipuntil show
1257 \dots
1258 \printuntil }
1259
1260 In the end we must remember to make \c main() pass the
1261 control to Qt. QCoreApplication::exec() will return when
1262 the application exits...
1263 \1/
1264 \endcode
1265
1266 See also \l {skipline-command} {\\skipline}, \l {skipto-command}
1267 {\\skipto} and \l {dots} {\\dots}.
1268
1269 \target dots-command
1270 \section1 \\dots
1271
1272 The \\dots command indicates that parts of the source file have
1273 been omitted when quoting a file.
1274
1275 The command is used in conjunction with the \l
1276 {quotefromfile-command} {\\quotefromfile} command, and should be
1277 stated on its own line. The dots are rendered on a new line, using
1278 a monospace font.
1279
1280 \badcode *
1281 /\1!
1282 \quotefromfile examples/main.cpp
1283 \skipto main
1284 \printuntil {
1285 \dots
1286 \skipuntil exec
1287 \printline }
1288 \1/
1289 \endcode
1290
1291 The default indentation is 4 spaces, but this can be adjusted
1292 using the command's optional argument.
1293
1294 \badcode *
1295 /\1!
1296 \dots 0
1297 \dots
1298 \dots 8
1299 \dots 12
1300 \dots 16
1301 \1/
1302 \endcode
1303
1304 See also \l {skipline-command} {\\skipline}, \l {skipto-command}
1305 {\\skipto} and \l {skipuntil-command} {\\skipuntil}.
1306
1307 \target snippet-command
1308 \section1 \\snippet
1309
1310 The \\snippet command causes a code snippet to be included
1311 verbatim as preformatted text, which may be syntax highlighted.
1312
1313 Each code snippet is referenced by the file that holds it and by
1314 a unique identifier for that file. Snippet files are typically
1315 stored in a \c{snippets} directory inside the documentation
1316 directory (for example, \c{$QTDIR/doc/src/snippets}).
1317
1318 For example, the following documentation references a snippet in a
1319 file residing in a subdirectory of the documentation directory:
1320
1321 \code
1322 \snippet snippets/textdocument-resources/main.cpp Adding a resource
1323 \endcode
1324
1325 The text following the file name is the unique identifier for the
1326 snippet. This is used to delimit the quoted code in the relevant
1327 snippet file, as shown in the following example that corresponds to
1328 the above \c{\snippet} command:
1329
1330 \code
1331 ...
1332 QImage image(64, 64, QImage::Format_RGB32);
1333 image.fill(qRgb(255, 160, 128));
1334
1335//! [Adding a resource]
1336 document->addResource(QTextDocument::ImageResource,
1337 QUrl("mydata://image.png"), QVariant(image));
1338//! [Adding a resource]
1339 ...
1340 \endcode
1341
1342 By default, QDoc looks for \c{//!} as a code snippet marker.
1343 For \c{.pro}, \c{.py}, \c{.cmake}, and \c{CMakeLists.txt}
1344 files, \c {#!} is detected. Finally, \c{<!--} is accepted in
1345 \c{.html}, \c{.qrc}, \c{.ui}, \c{.xml}, and \c{.xq} files.
1346
1347 QDoc normalizes snippet indentation by comparing the snippet-marker's
1348 space-based indentation against the snippet's minimum content indentation
1349 (ignoring Qt-macros, blank lines, and full-line comments). It then
1350 automatically un-indents the snippet body to whichever is smaller,
1351 ensuring the generated code always preserves its natural structure
1352 regardless of where the markers sit. Under-indented markers are left
1353 untouched.
1354
1355 \note QDoc only handles space characters for indentation normalization,
1356 not tabs or other whitespace. For best results, use consistent space-based
1357 indentation in source files containing snippets.
1358
1359 \target codeline-command
1360 \section1 \\codeline
1361
1362 The \\codeline command inserts a blank line of preformatted
1363 text. It is used to insert gaps between snippets without closing
1364 the current preformatted text area and opening a new one.
1365
1366*/
1367
1368
1369/*!
1370 \page 08-qdoc-commands-creatinglinks.html
1371 \previouspage Including External Code
1372 \nextpage Including Images
1373
1374 \title Creating Links
1375
1376 These commands are for creating hyperlinks to classes, functions,
1377 examples, and other targets.
1378
1379 \target l-command
1380 \section1 \\l (link)
1381
1382 The \\l link command is used to create a hyperlink to many
1383 different kinds of targets. The command's general syntax is:
1384
1385 \code
1386 \l [ link criteria ] { link target } { link text }
1387 \endcode
1388
1389 ...where the \c {link criteria} in square brackets are optional
1390 but may be required when the \c {link target} is ambiguous. See
1391 \l {Fixing Ambiguous Links} below.
1392
1393 You can use the \\l command to link to:
1394
1395 \list
1396
1397 \li an external page:
1398
1399 \badcode
1400 An URL with a custom link text:
1401 \l {http://doc.qt.io/qt-6/} {Qt 6 Documentation}.
1402
1403 An URL without a custom link text: \l {http://doc.qt.io/qt-6/}.
1404 \endcode
1405
1406 Renders as:
1407
1408 An URL with a custom link text:
1409 \l {http://doc.qt.io/qt-6/} {Qt 6 Documentation}.
1410
1411 An URL without a custom link text: \l {http://doc.qt.io/qt-6/}.
1412
1413 See also \l {externalpage-command}{\\externalpage}.
1414
1415 \li a documentation page. The link target can be:
1416
1417 \list
1418 \li the page title specified with the \l {title-command} {\\title}
1419 command:
1420
1421 \badcode
1422 Here is a link with a custom link text:
1423 \l {Getting Started with QDoc}{QDoc - Getting Started}.
1424
1425 Here is a link with a link text that is the same as the link
1426 target: \l {Getting Started with QDoc}.
1427 \endcode
1428
1429 Renders as:
1430
1431 Here is a link with a custom link text:
1432 \l {Getting Started with QDoc}{QDoc - Getting Started}.
1433
1434 Here is a link with a link text that is the same as link target:
1435 \l {Getting Started with QDoc}.
1436
1437 \li the page file name specified with the \l {page-command} {\\page}
1438 command:
1439
1440 \badcode
1441 \page 08-qdoc-commands-creatinglinks.html
1442 \title Creating Links
1443
1444 These commands are for creating hyperlinks to classes, functions,
1445 examples, and other targets.
1446
1447 ...
1448
1449 The \l {08-qdoc-commands-creatinglinks.html} {Creating Links page}
1450 explains how to create links with QDoc.
1451 \endcode
1452
1453 Renders as:
1454
1455 The \l {08-qdoc-commands-creatinglinks.html} {Creating Links page}
1456 article explains how to create links with QDoc.
1457
1458 \li the page with a \l {keyword-command} {\\keyword} command.
1459 \endlist
1460
1461 \li a particular anchor section within a document. The link target can be:
1462
1463 \list
1464 \li a section title specified with one of the
1465 \l{section-commands} {Section commands}:
1466
1467 \badcode
1468 Here is a link to a QDoc Commands section of the Writing
1469 Documentation topic:
1470 \l {Writing Documentation#QDoc Commands}{QDoc Commands}.
1471
1472 If you have unique section titles across your documentation
1473 project, you can use the section title as a target without
1474 the need to add the topic title:
1475 \l {QDoc Commands}.
1476 \endcode
1477
1478 Renders as:
1479
1480 Here is a link to a QDoc Commands section of the Writing
1481 Documentation topic:
1482 \l {Writing Documentation#QDoc Commands}{QDoc Commands}.
1483
1484 If you have unique section titles across your documentation
1485 project, you can use the section title as a target without the
1486 need to add the topic title:
1487 \l {QDoc Commands}.
1488
1489 Since the \c # character is used for the purpose of linking
1490 within documents it cannot be used verbatim when linking to
1491 titles that contain it. Instead, it must be escaped using a
1492 backslash:
1493
1494 \badcode
1495 \l {Using Qt with C\\#}
1496 \endcode
1497
1498 Two backslashes are used because QDoc will process the text
1499 before it is supplied to the link command.
1500
1501 \li an anchor defined with a \l {target-command}{\\target} command:
1502 \badcode
1503 \target assertions
1504
1505 Assertions make some statement about the text at the
1506 point where they occur in the regexp, but they do not
1507 match any characters.
1508
1509 ...
1510
1511 Regexps are built up from expressions, quantifiers, and
1512 \l {assertions} {assertions}.
1513
1514 \endcode
1515
1516 \endlist
1517
1518 \li an API item. Target links can be:
1519
1520 \list
1521 \li \c {\l QWidget} - The name of a class documented with the
1522 \l {class-command} {\\class} or
1523 \l {qmltype-command}{\\qmltype} command.
1524
1525 \li \c {\l QWidget::sizeHint()} - The signature of a function
1526 without parameters. If a matching function without
1527 parameters can't be found, the link is satisfied with the
1528 first matching function found.
1529
1530 \li \c {\l QWidget::removeAction(QAction* action)} - The
1531 signature of a function with parameters. If an exact match is
1532 not found, the link is not satisfied and QDoc reports a
1533 \e {Can't link to...} error.
1534
1535 \li \c {\l <QtGlobal>} - The subject of a \l {headerfile-command}
1536 {\\headerfile} command.
1537
1538 \endlist
1539 \li an example. The target link is the example title or a relative path
1540 used in an \l {example-command} {\\example} command:
1541
1542 \badcode *
1543 /\1!
1544 \example widgets/imageviewer
1545 \title ImageViewer Example
1546 \brief Shows how to combine QLabel and QScrollArea
1547 to display an image.
1548
1549 ...
1550 \1/
1551
1552 ...
1553
1554 See the example: \l widgets/imageviewer
1555 \endcode
1556 \endlist
1557
1558 If the link target is equivalent to the link text, you can omit the second
1559 argument.
1560
1561 For example, if you have documentation like:
1562
1563 \badcode *
1564 /\1!
1565 \target assertions
1566
1567 Assertions make some statement about the text at the
1568 point where they occur in the regexp, but they do not
1569 match any characters.
1570
1571 ...
1572
1573 Regexps are built up from expressions, quantifiers, and
1574 \l {assertions} {assertions}.
1575 \1/
1576 \endcode
1577
1578 You can simplify this as follows:
1579
1580 \badcode *
1581 /\1!
1582 \target assertions
1583
1584 Assertions make some statement about the text at the
1585 point where they occur in the regexp, but they do not
1586 match any characters.
1587
1588 ...
1589
1590 Regexps are built up from expressions, quantifiers, and
1591 \l assertions.
1592 \1/
1593 \endcode
1594
1595 For the one-parameter version, the braces can often be omitted.
1596
1597 QDoc also tries to make a link out of any word that doesn't
1598 resemble a normal English word, for example, Qt class names or
1599 functions, like QWidget or QWidget::sizeHint(). In these cases,
1600 the \\l command can actually be omitted, but by using the command,
1601 you ensure that QDoc will emit a warning if it cannot find the
1602 link target. In addition, if you only want the function name to
1603 appear in the link, you can use the following syntax:
1604
1605 \list
1606 \li \c {\l {QWidget::} {sizeHint()}}
1607 \endlist
1608
1609 \section2 Fixing Ambiguous Links
1610
1611 An ambiguous link is one that has a matching target in more than one Qt
1612 module or documentation set. For example, the same section title can appear
1613 in more than one Qt module, or the name of a C++ class in one module
1614 can also be the name of a QML type in another module.
1615 A real example in Qt is the name Qt itself: it is the name of both a C++
1616 namespace in QtCore and a QML type in QtQml.
1617
1618 Suppose we want to link to the \l {Qt} {Qt C++ namespace}. At the
1619 time QDoc generated this HTML page, that link was correct. Does
1620 it still go to the C++ namespace? Qdoc generated that link from
1621 this link command:
1622
1623 \list
1624 \li \c {\l {Qt} {Qt C++ namespace}}
1625 \endlist
1626
1627 Now suppose we want to link to the \l [QML] {Qt} {Qt QML type}.
1628 At the time QDoc generated this HTML page, that link was also
1629 correct, but we had to use this link command:
1630
1631 \list
1632 \li \c {\l [QML] {Qt} {Qt QML type}}
1633 \endlist
1634
1635 The \e {QML} in \e {square brackets} tells QDoc to accept a
1636 matching target only if the target is on a QML page. Qdoc actually
1637 finds the C++ namespace target first, but since that target is on
1638 a C++ page, QDoc ignores it and keeps looking until it finds the
1639 same target on a QML page.
1640
1641 Without the guidance in the \e{\\l command} in the optional \e
1642 {square bracket} argument, QDoc links to the first matching target
1643 it finds. QDoc can't warn that the link was ambiguous in such
1644 cases because it doesn't know that another matching target exists.
1645
1646 \section2 What arguments can appear in square brackets?
1647
1648 A link command with square bracket argument has the following syntax:
1649 \list
1650 \c {\l [QML|CPP|DOC|attached|QtModuleName] {link target} {link text}}
1651 \endlist
1652
1653 The \e {square bracket} argument is only allowed in the \c {\l
1654 (link)} command. The example above shows how \c QML is used as the
1655 \e {square brackets} argument to force QDoc to match a QML target.
1656 Most often, this will be a QML type, but it can also be a QML
1657 member function or property. Additionally, some QML types contain
1658 properties and attached properties with the same name. Attached
1659 properties can be selected with an \c attached argument.
1660 If \c attached is omitted, regular properties will be linked to
1661 in preference to attached properties with duplicate names.
1662
1663 In the example, QDoc didn't need a \e {square bracket} argument to
1664 find the Qt C++ namespace page, because that one was the first
1665 matching target QDoc found anyway. However, to force QDoc to find
1666 a C++ target when a matching QML target gets in the way, \c CPP
1667 can be used as the \e {square bracket} argument. For example, the
1668 following link will force QDoc to ignore the Qt QML type and continue
1669 searching until it matches the Qt C++ namespace.
1670
1671 \list
1672 \li \c {\l [CPP] {Qt} {Qt C++ namespace}}
1673 \endlist
1674
1675 If the link target is neither a C++ nor a QML entity, \c {DOC} can
1676 be used as the \e {square bracket} argument to prevent QDoc from
1677 matching either of those. At this writing, there were no cases of
1678 ambiguous links where using \c {DOC} was required.
1679
1680 Often, the documentor knows which Qt module the link target is
1681 in. When the module name is known, use the module name as the \e
1682 {square bracket} argument. In the example above, if we know that
1683 the QML type named Qt is located in the QtQml module, we can write
1684 the link command like this:
1685
1686 \list
1687 \li \c {\l [QtQml] {Qt} {Qt QML type}}
1688 \endlist
1689
1690 When a module name is used as the \e {square bracket} argument,
1691 QDoc will search for the link target in that module only. This
1692 makes searching for link targets more efficient.
1693
1694 Finally, the module name and entity type arguments can be
1695 combined, separated by a blank, so something like this is also
1696 allowed:
1697
1698 \list
1699 \li \c {\l [CPP QtQml] {Window} {C++ class Window}}
1700 \endlist
1701
1702 As of this writing, there were no cases where combining the two
1703 was required.
1704
1705 See also \l {sa-command} {\\sa}, \l {target-command} {\\target},
1706 and \l {keyword-command} {\\keyword}.
1707
1708
1709 \target sa-command
1710 \section1 \\sa (see also)
1711
1712 The \\sa command defines a list of links that will be rendered in
1713 a separate "See also" section at the bottom of the documentation
1714 unit.
1715
1716 The command takes a comma-separated list of links as its
1717 argument. If the line ends with a comma, you can continue
1718 the list on the next line. The general syntax is:
1719
1720 \code
1721 \sa {the first link}, {the second link},
1722 {the third link}, ...
1723 \endcode
1724
1725 QDoc will automatically try to generate "See also" links
1726 interconnecting a property's various functions. For example, a
1727 setVisible() function will automatically get a link to visible()
1728 and vice versa.
1729
1730 In general, QDoc will generate "See also" links that interconnect
1731 the functions that access the same property. It recognizes four
1732 different syntax versions:
1733
1734 \list
1735 \li \c property()
1736 \li \c setProperty()
1737 \li \c isProperty()
1738 \li \c hasProperty()
1739 \endlist
1740
1741 The \\sa command supports the same kind of links as the \l
1742 {l-command} {\\l} command.
1743
1744 \badcode *
1745 /\1!
1746 Appends the actions \a actions to this widget's
1747 list of actions.
1748
1749 \sa removeAction(), QMenu, addAction()
1750 \1/
1751 void QWidget::addActions(QList<QAction *> actions)
1752 {
1753 ...
1754 }
1755 \endcode
1756
1757 See also \l {l-command} {\\l}, \l {target-command} {\\target} and
1758 \l {keyword-command} {\\keyword}.
1759
1760
1761 \target target-command
1762 \section1 \\target
1763
1764 The \\target command names a place in the documentation that you
1765 can link to using the \l {l-command} {\\l (link)} and \l
1766 {sa-command} {\\sa (see also)} commands.
1767
1768 \e{The text up to the line break becomes the target name}. Be sure
1769 to follow the target name with a line break. Curly brackets are not
1770 required around the target name, but they may be required when the
1771 target name is used in a link command. See below.
1772
1773 \badcode *
1774 /\1!
1775 \target capturing parentheses
1776 \section1 Capturing Text
1777
1778 Parentheses allow us to group elements together so that
1779 we can quantify and capture them.
1780
1781 ...
1782 \1/
1783 \endcode
1784
1785 The target name \e{capturing parentheses} can be linked to
1786 in the following way:
1787
1788 \list
1789 \li \c {\l {capturing parentheses}}
1790 \endlist
1791
1792 Above, the target name is enclosed in brackets because it contains
1793 spaces.
1794
1795 \note The \\target command does not support \qdocvar macro expansion
1796 in its argument.
1797
1798 \section2 \\target in a \\table
1799 When you use the \\target command in a table, make sure that the
1800 \\target command follows a \l {li-command}{\\li}-command (table
1801 cell), as some generators only support targets to an individual cell,
1802 not to a whole row.
1803 Moreover, ensure that it's either on a separate line, or the last content
1804 that occurs in the line it's in. This is due to how the \\target
1805 command works; it consumes anything up to the next line break as
1806 its parameter. In other words, if you have a table and need a
1807 \\target within it, make sure that it follows the following
1808 structure:
1809
1810 \badcode
1811 \table
1812 \row
1813 \li \target my-target
1814 My text goes here.
1815 \li This is my next table cell.
1816 \endtable
1817 \endcode
1818
1819 See also \l {l-command} {\\l}, \l {sa-command} {\\sa} and \l
1820 {keyword-command} {\\keyword}.
1821
1822 \target keyword-command
1823 \section1 \\keyword
1824
1825 The \\keyword command names a place in the documentation that you
1826 can link to using the \l {l-command} {\\l (link)} and \l
1827 {sa-command} {\\sa (see also)} commands. It also adds the keyword
1828 and the location to generated indices.
1829
1830 The \\keyword command is like the \l {target-command} {\\target}
1831 command, except that when linking to a keyword, by default the link
1832 goes to the top of the QDoc comment (topic) the \\keyword appears in.
1833
1834 If you want to create a keyword for a \c section unit within a
1835 topic, add the \\keyword directly above the section title:
1836
1837 \badcode
1838 \keyword debug
1839 \section1 Debug command line option (--debug)
1840 ...
1841 \endcode
1842
1843 Unlike \\target, keywords are registered in indices of generated
1844 offline documentation files (.qch). This allows users to look up the
1845 location by keyword, for instance, in
1846 \l[QtAssistant]{Searching for Keywords}{Qt Assistant's Index Search},
1847 and makes the keyword accessible in \QC's context help.
1848
1849 Keywords must be unique over all the documents processed during
1850 the QDoc run. The command uses the rest of the line as its
1851 argument. Be sure to follow the keyword with a line break.
1852
1853
1854 \badcode *
1855 /\1!
1856 \class QRegularExpression
1857 \reentrant
1858 \brief The QRegularExpression class provides pattern
1859 matching using regular expressions.
1860 \ingroup tools
1861 \ingroup misc
1862 \ingroup shared
1863
1864 \keyword regular expression
1865
1866 Regular expressions, or "regexps", provide a way to
1867 find patterns within text.
1868
1869 ...
1870 \1/
1871 \endcode
1872
1873 The location marked with the keyword can be linked to with:
1874
1875 \badcode *
1876 /\1!
1877 When a string is surrounded by slashes, it is
1878 interpreted as a \l {regular expression}.
1879 \1/
1880 \endcode
1881
1882 If the keyword text contains spaces, the brackets are required.
1883
1884 \note The \\keyword command does not support \qdocvar macro expansion
1885 in its argument.
1886
1887 See also \l {l-command} {\\l (link)}, \l {sa-command} {\\sa (see
1888 also)} and \l {target-command} {\\target}.
1889
1890*/
1891
1892
1893/*!
1894 \page 09-qdoc-commands-includingimages.html
1895 \previouspage Creating Links
1896 \nextpage Tables and Lists
1897
1898 \title Including Images
1899
1900 The graphic commands makes it possible to include images in the
1901 documentation. The images can be rendered as separate paragraphs,
1902 or within running text.
1903
1904 \target image-command
1905 \section1 \\image
1906
1907 The \\image command expands to the image specified by its first
1908 argument, and renders it centered as a separate paragraph.
1909
1910 The command takes two arguments. The first argument is the name of
1911 the image file. The second argument is a description of what
1912 the image contains, and is used for the HTML \c alt attribute.
1913 Its contents is read aloud by screen readers, and its use is therefore
1914 strongly recommended for accessibility purposes. It may also be used by
1915 browsers that don't support images, like the Lynx text browser. You
1916 can also set the \l {usealttextastitle-variable} {usealttextastitle}
1917 variable to make QDoc generate a \e title attribute for the image, which
1918 commonly is rendered by graphical text browsers as a tooltip when the user
1919 hovers the mouse over the image.
1920
1921 While QDoc is quite forgiving, you should wrap both the file name and the
1922 description in curly braces, like so:
1923 \badcode
1924 \image {Bandit.png} {A Golden Retriever holding a bag of coffee in its mouth}
1925 \endcode
1926 This syntax is the most explicit and should always give the expected result.
1927 If not, be sure to follow the file name or the description with a line break.
1928 Curly brackets are required if the description argument spans multiple lines.
1929 If the description is wrapped in double quotes, QDoc will remove them before
1930 generating output. Special characters may be replaced with the corresponding
1931 HTML entity code in QDoc's HTML output.
1932
1933 \badcode *
1934 /\1!
1935 Qt is a C++ toolkit for cross-platform GUI application development.
1936
1937 \image {happyguy.jpg} {Happy guy}
1938
1939 Qt provides single-source portability across Microsoft
1940 Windows, macOS, Linux, and all major commercial Unix
1941 variants. It is also available for embedded devices.
1942 \1/
1943 \endcode
1944
1945 See also \l {inlineimage-command} {\\inlineimage} and \l
1946 {caption-command} {\\caption}.
1947
1948 \target inlineimage-command
1949 \section1 \\inlineimage
1950
1951 The \\inlineimage command expands to the image specified by its
1952 argument. The image is rendered inline with the rest of the text.
1953
1954 The command takes two arguments. The first argument is the name of
1955 the image file. The second argument is optional and is a simple
1956 description of the image within braces {}, equivalent to the HTML
1957 alt="" in an image tag. The description is used for tooltips, and
1958 for when a browser doesn't support images, like the Lynx text browser.
1959
1960 The most common use of the \\inlineimage command is in lists and
1961 tables. Here is an example of including inline images in a list:
1962
1963 \badcode *
1964 /\1!
1965 \list 1
1966 \li \inlineimage happy.gif {Oh so happy, I am a caption!}
1967 \li \inlineimage happy.gif Oh so happy, but I'm not a caption.
1968 \endlist
1969 \1/
1970 \endcode
1971
1972 Here is an example of including inline images in a table:
1973
1974 \badcode *
1975 /\1!
1976 \table
1977 \header
1978 \li Qt
1979 \li Qt Creator
1980 \row
1981 \li \inlineimage happy.gif {Oh so happy!}
1982 \li \inlineimage happy.gif Oh so happy!
1983 \row
1984 \li \inlineimage happy.gif Oh so happy!
1985 \li \inlineimage happy.gif {Oh so happy!}
1986 \endtable
1987 \1/
1988 \endcode
1989
1990 The command can also be used to insert an image inline with the
1991 text.
1992
1993 \badcode *
1994 /\1!
1995 \inlineimage training.jpg {Qt Training} The Qt Programming course is
1996 offered as a five day Open Enrollment Course. The classes are open to
1997 the public. Although the course is open to anyone who wants to learn,
1998 attendees should have significant experience in C++ development to
1999 derive maximum benefit from the course.
2000 \1/
2001 \endcode
2002
2003 See also \l {image-command} {\\image} and \l {caption-command} {\\caption}.
2004
2005 \target caption-command
2006 \section1 \\caption
2007
2008 The \\caption command provides a caption for an image.
2009
2010 The command takes all the text up to the end of the paragraph to
2011 be the caption. Experiment until you get the effect you want.
2012
2013 \badcode *
2014 /\1!
2015 \table 100%
2016 \row
2017 \li \image windows-pushbutton.png
2018 \caption The QPushButton widget provides a command button.
2019 \li \image windows-toolbutton.png
2020 \caption The QToolButton class provides a quick-access button to commands
2021 or options, usually used inside a QToolBar.
2022 \endtable
2023 \1/
2024 \endcode
2025
2026 See also \l {image-command} {\\image} and \l {inlineimage-command}
2027 {\\inlineimage}
2028*/
2029
2030
2031/*!
2032 \page 10-qdoc-commands-tablesandlists.html
2033 \previouspage Including Images
2034 \nextpage Special Content
2035
2036 \title Tables and Lists
2037
2038 These commands enable creating lists and tables. A list is
2039 rendered left aligned as a separate paragraph. A table is rendered
2040 centered as a separate paragraph. The table width depends on the
2041 width of its contents.
2042
2043 \target table-command
2044 \section1 \\table
2045
2046 The \\table and \\endtable commands delimit the contents of a
2047 table.
2048
2049 The command accepts a single argument specifying the table's width
2050 as a percentage of the page width:
2051
2052 \badcode *
2053 /\1!
2054 \table 100 %
2055
2056 ...
2057
2058 \endtable
2059 \1/
2060 \endcode
2061
2062 The code above ensures that the table will fill all available
2063 space. If the table's width is smaller than 100 %, the table will
2064 be centered in the generated documentation.
2065
2066 A table can contain headers, rows and columns. A row starts with a
2067 \l {row-command} {\\row} command and consists of cells, each of which
2068 starts with an \l {li-command} {\\li} command. There is also a \l
2069 {header-command} {\\header} command which is a special kind of row
2070 that has a special format.
2071
2072 \badcode *
2073 /\1!
2074 \table
2075 \header
2076 \li Qt Core Feature
2077 \li Brief Description
2078 \row
2079 \li \l {Signal and Slots}
2080 \li Signals and slots are used for communication
2081 between objects.
2082 \row
2083 \li \l {Layout Management}
2084 \li The Qt layout system provides a simple
2085 and powerful way of specifying the layout
2086 of child widgets.
2087 \row
2088 \li \l {Drag and Drop}
2089 \li Drag and drop provides a simple visual
2090 mechanism which users can use to transfer
2091 information between and within applications.
2092 \endtable
2093 \1/
2094 \endcode
2095
2096 You can also make cells span several rows and columns. For
2097 example:
2098
2099 \badcode *
2100 /\1!
2101 \table
2102 \header
2103 \li {3,1} This header cell spans three columns,
2104 but only one row.
2105 \row
2106 \li {2, 1} This table cell spans two columns,
2107 but only one row
2108 \li {1, 2} This table cell spans only one column,
2109 but two rows.
2110 \row
2111 \li A regular table cell
2112 \li A regular table cell
2113 \endtable
2114 \1/
2115 \endcode
2116
2117 See also \l {header-command} {\\header}, \l {row-command} {\\row} and \l {li-command} {\\li}.
2118
2119 \target header-command
2120 \section1 \\header
2121
2122 The \\header command indicates that the following table cells are
2123 the current table's column headers.
2124
2125 The command can only be used within the \l{table-command}
2126 {\\table...\\endtable} commands. A header can contain several
2127 cells. A cell is created with the \l {li-command} {\\li} command.
2128
2129 A header cell's text is centered within the table cell and
2130 rendered using a bold font.
2131
2132 \badcode *
2133 /\1!
2134 \table
2135 \header
2136 \li Qt Core Feature
2137 \li Brief Description
2138 \row
2139 \li \l {Signal and Slots}
2140 \li Signals and slots are used for communication
2141 between objects.
2142 \endtable
2143 \1/
2144 \endcode
2145
2146 See also \l {table-command} {\\table}, \l {row-command} {\\row} and \l {li-command} {\\li}.
2147
2148 \target row-command
2149 \section1 \\row
2150
2151 The \\row command begins a new row in a table. The \l {li-command}
2152 {\\li items} that belong in the new row will immediately follow the
2153 \\row.
2154
2155 The command can only be used within the \l{table-command}
2156 {\\table...\\endtable} commands. A row can contain several
2157 cells. A cell is created with the \l {li-command} {\\li} command.
2158
2159 The background cell color of each row alternates between two
2160 shades of grey, making it easier to distinguish the rows from each
2161 other. The cells' contents is left aligned.
2162
2163 \badcode *
2164 /\1!
2165 \table
2166 \header
2167 \li Qt Core Feature
2168 \li Brief Description
2169 \row
2170 \li \l {Signal and Slots}
2171 \li Signals and slots are used for communication
2172 between objects.
2173 \row
2174 \li \l {Layout Management}
2175 \li The Qt layout system provides a simple
2176 and powerful way of specifying the layout
2177 of child widgets.
2178 \row
2179 \li \l {Drag and Drop}
2180 \li Drag and drop provides a simple visual
2181 mechanism which users can use to transfer
2182 information between and within applications.
2183 \endtable
2184 \1/
2185 \endcode
2186
2187 See also \l {table-command} {\\table}, \l {header-command}
2188 {\\header}, and \l {li-command} {\\li}.
2189
2190 \target value-command
2191 \section1 \\value
2192
2193 The \\value command starts the documentation of a C++ enum item.
2194
2195 The command's first argument is the value name. The value name may
2196 be preceded by an optional \e since clause enclosed in square
2197 brackets. The value description follows the value name. The description
2198 ends at the next blank line or \\value. The arguments are rendered in a
2199 table.
2200
2201 \note To include images in the \\value description, use the
2202 \l {inlineimage-command}{\\inlineimage} command.
2203
2204 Without a \e since clause, a \\value command could look like this:
2205
2206 \code
2207 \value QtInfoMsg A message generated by the qInfo() function.
2208 \endcode
2209
2210 The same command with a \e since clause would look like this:
2211
2212 \code
2213 \value [since 5.5] QtInfoMsg A message generated by the qInfo() function.
2214 \endcode
2215
2216 The documentation will be located in the associated class, header
2217 file or namespace documentation. See the \l {enum-command}
2218 {\\enum} documentation for an example.
2219
2220 \note Since Qt 5.4, \\value command can also be used outside the
2221 \l {enum-command} {\\enum} topic. In this case, QDoc renders a
2222 two-column table listing the constant name (taken as-is from the
2223 first argument) and its description. This can be used, for
2224 example, in \l {qmlproperty-command}{\\qmlproperty} topic for
2225 documenting acceptable values for a QML enumeration property.
2226
2227 See also \l {enum-command} {\\enum} and \l {omitvalue-command} {\\omitvalue}.
2228
2229 \target omitvalue-command
2230 \section1 \\omitvalue
2231
2232 The \\omitvalue command excludes a C++ enum item from the
2233 documentation.
2234
2235 The command's only mandatory argument is the name of the enum item
2236 that will be omitted. If the enum item is followed by a single-line
2237 description, that is also omitted.
2238
2239 See the \l {enum-command} {\\enum} documentation for an example.
2240
2241 See also \l {enum-command} {\\enum} and \l {value-command}
2242 {\\value} \l {since-command}{\\since}
2243
2244 \target list-command
2245 \section1 \\list
2246
2247 The \\list and \\endlist commands delimit a list of items.
2248
2249 Create each list item with the \l {li-command} {\\li} command. A
2250 list always contains one or more items. Lists can be nested. For
2251 example:
2252
2253 \badcode *
2254 /\1!
2255 \list
2256 \li Qt Reference Documentation: Getting Started
2257 \list
2258 \li How to Learn Qt
2259 \li Installation
2260 \list
2261 \li Qt/X11
2262 \li Qt/Windows
2263 \li Qt/Mac
2264 \li Qt/Embedded
2265 \endlist
2266 \li Tutorial and Examples
2267 \endlist
2268 \endlist
2269 \1/
2270 \endcode
2271
2272 The \\list command takes an optional argument providing
2273 alternative appearances for the list items.
2274
2275 \badcode *
2276 /\1!
2277 \list
2278 \li How to Learn Qt
2279 \li Installation
2280 \li Tutorial and Examples
2281 \endlist
2282 \1/
2283 \endcode
2284
2285 If you provide 'A' as an argument to the \\list command, the
2286 bullets are replaced with characters in alphabetical order:
2287
2288 \list A
2289 \li How to Learn Qt
2290 \li Installation
2291 \li Tutorial and Examples
2292 \endlist
2293
2294 If you replace 'A' with '1', the list items are numbered in
2295 ascending order:
2296
2297 \list 1
2298 \li How to Learn Qt
2299 \li Installation
2300 \li Tutorial and Examples
2301 \endlist
2302
2303 If you provide 'i' as the argument, the bullets are replaced with
2304 roman numerals:
2305
2306 \list i
2307 \li How to Learn Qt
2308 \li Installation
2309 \li Tutorial and Examples
2310 \endlist
2311
2312 Finally, you can make the list items appear with roman numbers
2313 following in ascending order if you provide 'I' as the optional
2314 argument:
2315
2316 \list I
2317 \li How to Learn Qt
2318 \li Installation
2319 \li Tutorial and Examples
2320 \endlist
2321
2322 You can also make the listing start at any character or number by
2323 simply provide the number or character you want to start at. For
2324 example:
2325
2326 \badcode *
2327 /\1!
2328 \list G
2329 \li How to Learn Qt
2330 \li Installation
2331 \li Tutorial and Examples
2332 \endlist
2333 \1/
2334 \endcode
2335
2336 See also \l {li-command} {\\li}.
2337
2338 \target li-command
2339 \section1 \\li (table cell, list item)
2340
2341 The \\li command marks a table cell or a list item. This command
2342 is only used in \l{table-command} {tables} and \l{list-command}
2343 {lists}.
2344
2345 It considers everything as its argument until the next \\li command, until the
2346 next \l {table-command} {\\endtable}, or \l {list-command} {\\endlist}
2347 command. See \l {table-command} {\\table} and \l {list-command} {\\list}
2348 for examples.
2349
2350 If the command is used within a table, you can also specify
2351 how many rows or columns the item should span.
2352
2353 \badcode *
2354 /\1!
2355 \table
2356 \header
2357 \li {3,1} This header cell spans three columns
2358 but only one row.
2359 \row
2360 \li {2, 1} This table item spans two columns
2361 but only one row
2362 \li {1, 2} This table item spans only one column,
2363 but two rows.
2364 \row
2365 \li A regular table item
2366 \li A regular table item
2367 \endtable
2368 \1/
2369 \endcode
2370
2371 If not specified, the item will span one column and one row.
2372
2373 See also \l {table-command} {\\table}, \l {header-command}
2374 {\\header}, and \l {list-command} {\\list}.
2375
2376*/
2377
2378
2379/*!
2380 \page 11-qdoc-commands-specialcontent.html
2381 \previouspage Tables and Lists
2382 \nextpage Miscellaneous
2383
2384 \title Special Content
2385
2386 The document contents commands identify parts of the documentation,
2387 parts with a special rendering, conceptual meaning or
2388 function.
2389
2390 \target quotation-command
2391 \section1 \\quotation
2392
2393 The \\quotation and \\endquotation commands delimit a long quotation.
2394
2395 The text in the delimited block is surrounded by
2396 \b{<blockquote>} and \b{</blockquote>} in the html output,
2397 e.g.:
2398
2399 \badcode *
2400 /\1!
2401 Although the prospect of a significantly broader market is
2402 good news for Firstlogic, the notion also posed some
2403 challenges. Dave Dobson, director of technology for the La
2404 Crosse, Wisconsin-based company, said:
2405
2406 \quotation
2407 As our solutions were being adopted into new
2408 environments, we saw an escalating need for easier
2409 integration with a wider range of enterprise
2410 applications.
2411 \endquotation
2412 \1/
2413 \endcode
2414
2415 The text in the \b{\\quotation} block will appear in the generated HTML as:
2416
2417 \badcode
2418 <blockquote>
2419 <p>As our solutions were being adopted into new environments,
2420 we saw an escalating need for easier integration with a wider
2421 range of enterprise applications.</p>
2422 </blockquote>
2423 \endcode
2424
2425 The built-in style sheet for most browsers will render the
2426 contents of the <blockquote> tag with left and right
2427 indentations. The example above would be rendered as:
2428
2429 \quotation
2430 As our solutions were being adopted into new
2431 environments, we saw an escalating need for easier
2432 integration with a wider range of enterprise
2433 applications.
2434 \endquotation
2435
2436 But you can redefine the \b{<blockquote>} tag in your style.css file.
2437
2438
2439 \target note-command
2440 \section1 \\note
2441
2442 The \\note command defines a new paragraph preceded by "Note:"
2443 in bold. The command takes a continuous paragraph as the argument,
2444 terminating after the end of the paragraph. The note command is only for
2445 shorter statements and not for longer multiline paragraphs.
2446
2447 Similar to the \l{warning-command}{\\warning} command, the note is for
2448 short and important statements. See
2449 \l{https://wiki.qt.io/Qt_Writing_Guidelines}{Qt Writing Guidelines} for
2450 usage information.
2451
2452 \target notranslate-command
2453 \section1 \\notranslate
2454
2455 The \\notranslate command indicates that its argument is \b not to be translated,
2456 when the generated output is passed to a language translation service.
2457
2458 Other commands (\qdoccmd {c}, \qdoccmd {tt}) have the same effect, but
2459 \\notranslate does not style its argument in any way.
2460
2461 This command was introduced in QDoc version 6.10.
2462
2463 \target brief-command
2464 \section1 \\brief
2465
2466 The \\brief command introduces a one-sentence description of
2467 any of the \l{Topic Commands}.
2468
2469 The brief text is used to introduce the documentation of the
2470 associated object, and in lists generated using the \l
2471 {generatelist-command} {\\generatelist} command and the \l
2472 {annotatedlist-command} {\\annotatedlist} command.
2473
2474 The brief text will be displayed in the documentation
2475 for that particular topic.
2476
2477 For example the boolean QWidget::isWindow property:
2478
2479 \badcode *
2480 /\1!
2481 \property QWidget::isActiveWindow
2482 \brief Whether this widget's window is the active window.
2483
2484 The active window is the window that contains the widget that
2485 has keyboard focus.
2486
2487 When popup windows are visible, this property is \c true
2488 for both the active window \e and the popup.
2489
2490 \sa activateWindow(), QApplication::activeWindow()
2491 \1/
2492 \endcode
2493
2494 and the QWidget::geometry property
2495
2496 \badcode *
2497 /\1!
2498 \property QWidget::geometry
2499 \brief The geometry of the widget relative to its parent and
2500 excluding the window frame.
2501
2502 When changing the geometry, the widget, if visible,
2503 receives a move event (moveEvent()) and/or a resize
2504 event (resizeEvent()) immediately.
2505
2506 ...
2507
2508 \sa frameGeometry(), rect(), ...
2509 \1/
2510 \endcode
2511
2512 When the \\brief command is used to describe a class, we recommend
2513 using a complete sentence like this:
2514
2515 \badcode
2516 The <classname> class is|provides|contains|specifies...
2517 \endcode
2518
2519 \warning Do not repeat your detailed description with the same sentence as
2520 the brief statement will be the first paragraph of the detailed
2521 description.
2522
2523 \badcode *
2524 /\1!
2525 \class PreviewWindow
2526 \brief The PreviewWindow class is a custom widget
2527 displaying the names of its currently set
2528 window flags in a read-only text editor.
2529
2530 The PreviewWindow class inherits QWidget. The widget
2531 displays the names of its window flags set with the
2532 setWindowFlags() function. It is also provided with a
2533 QPushButton that closes the window.
2534
2535 ...
2536
2537 \sa QWidget
2538 \1/
2539 \endcode
2540
2541 Using \\brief in a \l{namespace-command}{\\namespace}:
2542
2543 \badcode *
2544 /\1!
2545 \namespace Qt
2546
2547 \brief The Qt namespace contains miscellaneous identifiers
2548 used throughout the Qt library.
2549 \1/
2550 \endcode
2551
2552 Using \\brief in a \l{headerfile-command}{\\headerfile}:
2553
2554 \badcode *
2555 /\1!
2556 \headerfile <QtGlobal>
2557 \title Global Qt Declarations
2558
2559 \brief The <QtGlobal> header file provides basic
2560 declarations and is included by all other Qt headers.
2561
2562 \sa <QtAlgorithms>
2563 \1/
2564 \endcode
2565
2566 See also \l{property-command} {\\property}, \l{class-command}
2567 {\\class}, \l{namespace-command} {\\namespace} and
2568 \l{headerfile-command} {\\headerfile}.
2569
2570 \target legalese-command
2571 \section1 \\legalese
2572
2573 The \\legalese and \\endlegalese commands delimit a license agreement.
2574
2575 In the generated HTML, the delimited text is surrounded by a \b
2576 {<div class="LegaleseLeft">} and \b {</div>} tags.
2577
2578 An example of a license agreement enclosed in \\legalese
2579 and \\endlegalese:
2580
2581 \badcode *
2582 /\1!
2583 \legalese
2584 Copyright 1996 Daniel Dardailler.
2585
2586 Permission to use, copy, modify, distribute, and sell this
2587 software for any purpose is hereby granted without fee,
2588 provided that the above copyright notice appear in all
2589 copies and that both that copyright notice and this
2590 permission notice appear in supporting documentation, and
2591 that the name of Daniel Dardailler not be used in
2592 advertising or publicity pertaining to distribution of the
2593 software without specific, written prior permission. Daniel
2594 Dardailler makes no representations about the suitability of
2595 this software for any purpose. It is provided "as is"
2596 without express or implied warranty.
2597
2598 Modifications Copyright 1999 Matt Koss, under the same
2599 license as above.
2600 \endlegalese
2601 \1/
2602 \endcode
2603
2604 It will appear in the generated HTML as:
2605
2606 \badcode
2607 <div class="LegaleseLeft">
2608 <p>Copyright 1996 Daniel Dardailler.</p>
2609 <p>Permission to use, copy, modify, distribute, and sell
2610 this software for any purpose is hereby granted without fee,
2611 provided that the above copyright notice appear in all
2612 copies and that both that copyright notice and this
2613 permission notice appear in supporting documentation, and
2614 that the name of Daniel Dardailler not be used in
2615 advertising or publicity pertaining to distribution of the
2616 software without specific, written prior permission. Daniel
2617 Dardailler makes no representations about the suitability of
2618 this software for any purpose. It is provided "as is"
2619 without express or implied warranty.</p>
2620
2621 <p>Modifications Copyright 1999 Matt Koss, under the same
2622 license as above.</p>
2623 </div>
2624 \endcode
2625
2626 If the \\endlegalese command is omitted, QDoc will process the
2627 \\legalese command but considers the rest of the documentation
2628 page as the license agreement.
2629
2630 Ideally, the license text is located with the licensed code.
2631
2632 Elsewhere, the documentation identified as \e{\\legalese} command
2633 can be accumulated using \l {generatelist-command} {\\generatelist}
2634 with \c {legalese} as the argument. This is useful for generating
2635 an overview of the license agreements associated with the source
2636 code.
2637
2638 \note The output of the \c {\generatelist legalese} command includes
2639 the \\legalese texts in the current documentation project only. If
2640 the current documentation project depends on other modules, their
2641 license texts will not be listed.
2642
2643 \target warning-command
2644 \section1 \\warning
2645
2646 The \\warning command prepends "Warning:" to the command's
2647 argument, in bold font.
2648
2649 \badcode *
2650 /\1!
2651 Qt::HANDLE is a platform-specific handle type
2652 for system objects. This is equivalent to
2653 \c{void *} on Windows and macOS, and to
2654 \c{unsigned long} on X11.
2655
2656 \warning Using this type is not portable.
2657 \1/
2658 \endcode
2659*/
2660
2661
2662/*!
2663 \page 12-0-qdoc-commands-miscellaneous.html
2664 \previouspage Special Content
2665 \nextpage The QDoc Configuration File
2666
2667 \title Miscellaneous
2668
2669 These commands provide miscellaneous functions connected to the
2670 visual appearance of the documentation, and to the process of
2671 generating the documentation.
2672
2673 \target annotatedlist-command
2674 \section1 \\annotatedlist
2675
2676 The \\annotatedlist command expands to a list of the members of a
2677 group, each member listed with its \e {brief} text. Below is an
2678 example from the Qt Reference Documentation:
2679
2680 \badcode *
2681 /\1!
2682 ...
2683 \section1 Drag and Drop Classes
2684
2685 These classes deal with drag and drop and the necessary mime type
2686 encoding and decoding.
2687
2688 \annotatedlist draganddrop
2689 \1/
2690 \endcode
2691
2692 This generates a list of all the C++ classes and/or QML types in
2693 the \e{draganddrop} group. A C++ class or QML type in the
2694 \e{draganddrop} group will have \e{\\ingroup draganddrop} in its
2695 \e{\\class} or \e{\\qmltype} comment.
2696
2697 The group members are sorted in ascending order, based on
2698 user-visible name or title. Since QDoc 6.8, \\annotatedlist
2699 and \qdoccmd generatelist support also custom sorting.
2700
2701 See also \qdoccmd generatelist and \l {Sorting group members}.
2702
2703 \target cmakepackage-command
2704 \section1 \\cmakepackage
2705
2706 Use the \\cmakepackage command to add CMake package information to classes
2707 and namespaces. This information will then appear in a table at the top of
2708 the class or namespace documentation page. For example:
2709
2710 \badcode *
2711 /*!
2712 \namespace Foo
2713 \inheaderfile Bar
2714 \cmakepackage Baz
2715 \brief A namespace.
2716
2717 ...
2718 \1/
2719 \endcode
2720
2721 QDoc will output this as
2722
2723 \quotation
2724 \raw HTML
2725 <h1 class="title">Foo Namespace</h1>
2726 <p>A namespace. <a>More...</a></p>
2727 <div class="table"><table class="alignedsummary">
2728 <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include &lt;Bar&gt;</span></td></tr>
2729 <tr><td class="memItemLeft rightAlign topAlign"> CMake:</td><td class="memItemRight bottomAlign"> find_package(Baz REQUIRED)<br/>target_link_libraries(mytarget PRIVATE Baz::Baz)</td></tr>
2730 </table></div>
2731 \endraw
2732 \endquotation
2733
2734 \e{See also} \l{module-command}{\\module} and
2735 \l{cmakecomponent}{\\cmakecomponent}}
2736
2737 \target cmakecomponent-command
2738 \section1 \\cmakecomponent
2739
2740 Use the \\cmakecomponent command to add CMake component information to classes
2741 and namespaces. This information will then appear in a table at the top of
2742 the class or namespace documentation page. For example:
2743
2744 \badcode *
2745 /*!
2746 \namespace Foo
2747 \inheaderfile Bar
2748 \cmakecomponent Baz
2749 \brief A namespace.
2750
2751 ...
2752 \1/
2753 \endcode
2754
2755 QDoc will output this as
2756
2757 \quotation
2758 \raw HTML
2759 <h1 class="title">Foo Namespace</h1>
2760 <p>A namespace. <a>More...</a></p>
2761 <div class="table"><table class="alignedsummary">
2762 <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include &lt;Bar&gt;</span></td></tr>
2763 <tr><td class="memItemLeft rightAlign topAlign"> CMake:</td><td class="memItemRight bottomAlign"> find_package(Qt6 REQUIRED COMPONENTS Baz)<br/>target_link_libraries(mytarget PRIVATE Qt6::Baz)</td></tr>
2764 </table></div>
2765 \endraw
2766 \endquotation
2767
2768 \e{See also} \l{module-command}{\\module} and
2769 \l{cmakepackage}{\\cmakepackage}}
2770
2771 \target cmaketargetitem-command
2772 \section1 \\cmaketargetitem
2773
2774 Use the \\cmaketargetitem command to override the \e {item} part of the
2775 CMake \c{target_link_libraries} information that's added to classes and
2776 namespaces. The command must be used in conjunction with the
2777 \l{module-command}{\\module} and \l{cmakecomponent}{\\cmakecomponent}
2778 commands. For example:
2779
2780 \badcode *
2781 /*!
2782 \namespace Foo
2783 \inheaderfile Bar
2784 \cmakecomponent Baz
2785 \cmaketargetitem Qt6::BazPrivate
2786 \brief A namespace.
2787
2788 ...
2789 \1/
2790 \endcode
2791
2792 QDoc will output this as
2793
2794 \quotation
2795 \raw HTML
2796 <h1 class="title">Foo Namespace</h1>
2797 <p>A namespace. <a>More...</a></p>
2798 <div class="table"><table class="alignedsummary">
2799 <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include &lt;Bar&gt;</span></td></tr>
2800 <tr><td class="memItemLeft rightAlign topAlign"> CMake:</td><td class="memItemRight bottomAlign"> find_package(Qt6 REQUIRED COMPONENTS Baz)<br/>target_link_libraries(mytarget PRIVATE Qt6::BazPrivate)</td></tr>
2801 </table></div>
2802 \endraw
2803 \endquotation
2804
2805 \e{See also} \l{module-command}{\\module} and
2806 \l{cmakecomponent}{\\cmakecomponent}}
2807
2808
2809 \target qtcmakepackage-command
2810 \section1 \\qtcmakepackage
2811
2812 Use the \\qtcmakepackage command to add CMake package information to classes
2813 and namespaces. This information will then appear in a table at the top of
2814 the class or namespace documentation page. For example:
2815
2816 \badcode *
2817 /*!
2818 \namespace Foo
2819 \inheaderfile Bar
2820 \qtcmakepackage Baz
2821 \brief A namespace.
2822
2823 ...
2824 \1/
2825 \endcode
2826
2827 QDoc will output this as
2828
2829 \quotation
2830 \raw HTML
2831 <h1 class="title">Foo Namespace</h1>
2832 <p>A namespace. <a>More...</a></p>
2833 <div class="table"><table class="alignedsummary">
2834 <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include &lt;Bar&gt;</span></td></tr>
2835 <tr><td class="memItemLeft rightAlign topAlign"> CMake:</td><td class="memItemRight bottomAlign"> find_package(Qt6 REQUIRED COMPONENTS Baz)</td></tr>
2836 </table></div>
2837 \endraw
2838 \endquotation
2839
2840
2841 \target qtcmaketargetitem-command
2842 \section1 \\qtcmaketargetitem
2843
2844 Use the \\qtcmaketargetitem command to override the \e {item} part of the
2845 CMake \c{target_link_libraries} information that's added to classes and
2846 namespaces. The command must be used in conjunction with the
2847 \l{module-command}{\\module} and \l{qtcmakepackage}{\\qtcmakepackage}
2848 commands.
2849
2850 \e{See also} \l{module-command}{\\module} and
2851 \l{qtcmakepackage}{\\qtcmakepackage}}
2852
2853
2854 \target generatelist-command
2855 \section1 \\generatelist
2856
2857 The \\generatelist command expands to a list of links to the
2858 documentation entities grouped with an \l {ingroup-command}
2859 {\\ingroup} command or entities that match one of the arguments
2860 listed below. An example from the Qt Reference Documentation:
2861
2862 \badcode *
2863 /\1!
2864 \page classes.html
2865 \title All Classes
2866
2867 For a shorter list that only includes the most
2868 frequently used classes, see \l{Qt's Main Classes}.
2869
2870 \generatelist classes Q
2871 \1/
2872 \endcode
2873
2874 This generates the \e {All Classes} page. The command accepts the
2875 following arguments:
2876
2877 \section2 \c {<group-name>}
2878
2879 With a group name as the only argument, QDoc lists all entities that
2880 use the \c {\ingroup <group-name>} command.
2881
2882 \section3 Sorting group members
2883
2884 When generating a list of group members, they are sorted in ascending
2885 order, based on user-visible name or title. Since QDoc 6.8, the default
2886 sort order can be modified:
2887
2888 \badcode
2889 \generatelist [descending] changelogs
2890 \endcode
2891
2892 Assuming the \e changelogs group consists of pages
2893 detailing changes in different versions, this generates the
2894 list in descending order (newest version first).
2895
2896 \section4 Sort key
2897
2898 Since QDoc 6.8, a custom sort key can be assigned to one or
2899 more group members using the \qdoccmd meta command:
2900
2901 \badcode
2902 \meta sortkey {sort key}
2903 \endcode
2904
2905 Sorting (ascending or descending) is then done based on
2906 these key(s), rather than user-visible titles.
2907
2908 \note Any group member with a sort key is listed \e before
2909 members without a key (in the default ascending order). This
2910 allows raising individual group member(s) to the top of the
2911 list.
2912
2913 \target table example
2914 \section2 \c annotatedclasses
2915
2916 The \c annotatedclasses argument provides a table containing the
2917 names of all the classes, and a description of each class. Each
2918 class name is a link to the class's reference documentation. For
2919 example:
2920
2921 \table
2922 \row
2923 \li QDial
2924 \li Rounded range control (like a speedometer or potentiometer)
2925 \row
2926 \li QDialog
2927 \li The base class of dialog windows
2928 \row
2929 \li QDir
2930 \li Access to directory structures and their contents
2931 \endtable
2932
2933 A C++ class is documented with the \l {class-command} {\\class}
2934 command. The annotation for the class is taken from the argument
2935 of the class comment's \l {brief-command} {\\brief} command.
2936
2937 \section2 \c annotatedexamples
2938
2939 The \c annotatedexamples argument provides a complete list of all
2940 examples as a set of tables containing the titles of all the
2941 examples, and a description of each example. Each title is a
2942 link to the example's documentation.
2943
2944 A separate table for each module (that has documented examples)
2945 is generated, provided that the module has defined a
2946 navigation.landingpage configuration variable. The \e landingpage
2947 variable is used as a title for a header that precedes each table.
2948
2949 \section2 \c annotatedattributions
2950
2951 The \c annotatedattributions argument provides a complete list of all
2952 attributions as a set of tables containing the titles of all the
2953 attributions, and a description of each attribution. Each title is a
2954 link to the attribution's page.
2955
2956 A separate table for each module (that has attributions)
2957 is generated, provided that the module has defined a
2958 navigation.landingpage configuration variable. The \e landingpage
2959 variable is used as a title for a header that precedes each table.
2960
2961 \target list example
2962 \section2 \c {classes <prefix>}
2963
2964 The \c classes argument provides a complete alphabetical list of
2965 the classes. The second argument, \c{<prefix>}, is the common
2966 prefix for the class names. The class names will be sorted on the
2967 character that follows the common prefix. e.g. The common prefix
2968 for the Qt classes is \c Q. The common prefix argument is
2969 optional. If no common prefix is provided, the class names will
2970 be sorted on their first character.
2971
2972 Each class name becomes a link to the class's reference
2973 documentation. This command is used to generate the
2974 \e {All Classes} page this way:
2975
2976 \badcode *
2977 /\1!
2978 \page classes.html
2979 \title All Classes
2980 \ingroup classlists
2981
2982 \brief Alphabetical list of classes.
2983
2984 This is a list of all Qt classes. For classes that
2985 have been deprecated, see the \l{Obsolete Classes}
2986 list.
2987
2988 \generatelist classes Q
2989 \1/
2990 \endcode
2991
2992 A C++ class is documented with the \l {class-command} {\\class}
2993 command.
2994
2995 \section2 \c classesbymodule
2996
2997 When this argument is used, a second argument is required, which
2998 specifies the module whose classes are to be listed. QDoc
2999 generates a table containing those classes. Each class is listed
3000 with the text of its \l{brief-command} {\\brief} command.
3001
3002 For example, this command can be used on a module page as follows:
3003
3004 \badcode *
3005 /\1!
3006 \page phonon-module.html
3007 \module Phonon
3008 \title Phonon Module
3009 \ingroup modules
3010
3011 \brief Contains namespaces and classes for multimedia functionality.
3012
3013 \generatelist{classesbymodule Phonon}
3014
3015 ...
3016 \1/
3017 \endcode
3018
3019 Each class that is a member of the specified module must be marked
3020 with the \l {inmodule-command} {\\inmodule} command in its \\class
3021 comment.
3022
3023 \section2 \c qmltypesbymodule
3024
3025 Similar to \c classesbymodule argument, but used for listing the
3026 QML types (excluding QML value types) from the QML module specified
3027 with the second argument.
3028
3029 \note Support for this argument was introduced in QDoc 5.6.
3030
3031 \section2 \c qmlvaluetypesbymodule
3032
3033 Similar to \c qmltypesbymodule argument, but lists QML value
3034 types instead.
3035
3036 \note Support for this argument was introduced in QDoc 6.7.
3037
3038 \section2 \c functionindex
3039
3040 The \c functionindex argument provides a complete alphabetical
3041 list of all the documented member functions. It is normally used
3042 only to generate the \e {Qt function index} page
3043 this way:
3044
3045 \badcode *
3046 /\1!
3047 \page functions.html
3048 \title All Functions
3049 \ingroup funclists
3050
3051 \brief All documented Qt functions listed alphabetically with a
3052 link to where each one is declared.
3053
3054 This is the list of all documented member functions and global
3055 functions in the Qt API. Each function has a link to the
3056 class or header file where it is declared and documented.
3057
3058 \generatelist functionindex
3059 \1/
3060 \endcode
3061
3062 \section2 \c legalese
3063
3064 The \c legalese argument tells QDoc to generate a list of licenses in
3065 the current documentation project. Each license is identified using
3066 the \l {legalese-command} {\\legalese} command.
3067
3068 \section2 \c overviews
3069
3070 The \c overviews argument is used to tell QDoc to generate a list
3071 by concatenating the contents of all the \l {group-command}
3072 {\\group} pages. Qt uses it to generate the \e {overviews} page
3073 this way:
3074
3075 \badcode *
3076 /\1!
3077 \page overviews.html
3078
3079 \title All Overviews and HOWTOs
3080
3081 \generatelist overviews
3082 \1/
3083 \endcode
3084
3085 \section2 \c attributions
3086
3087 The \c attributions argument is used to tell QDoc to generate a list
3088 of attributions in the documentation.
3089
3090 \section2 \c related
3091
3092 The \c related argument is used in combination with the \l
3093 {group-command} {\\group} and \l {ingroup-command} {\\ingroup}
3094 commands to list all the overviews related to a specified
3095 group. For example, the page for the \e {Programming with Qt}
3096 page is generated this way:
3097
3098 \badcode *
3099 /\1!
3100 \group qt-basic-concepts
3101 \title Programming with Qt
3102
3103 \brief The basic architecture of the Qt cross-platform application and UI framework.
3104
3105 Qt is a cross-platform application and UI framework for
3106 writing web-enabled applications for desktop, mobile, and
3107 embedded operating systems. This page contains links to
3108 articles and overviews explaining key components and
3109 techniuqes used in Qt development.
3110
3111 \generatelist {related}
3112 \1/
3113 \endcode
3114
3115 Each page listed on this group page contains the command:
3116
3117 \code
3118 \ingroup qt-basic-concepts
3119 \endcode
3120
3121 See also \qdoccmd {annotatedlist}.
3122
3123 \target if-command
3124 \section1 \\if
3125
3126 The \\if command and the corresponding \\endif command
3127 enclose parts of a QDoc comment that only will be included if
3128 the condition specified by the command's argument is true.
3129
3130 The command reads the rest of the line and parses it as an C++ #if
3131 statement.
3132
3133 \badcode *
3134 /\1!
3135 \if defined(opensourceedition)
3136
3137 \note This edition is for the development of
3138 \l{Qt Open Source Edition} {Free and Open Source}
3139 software only; see \l{Qt Commercial Editions}.
3140
3141 \endif
3142 \1/
3143 \endcode
3144
3145 This QDoc comment will only be rendered if the \c
3146 opensourceedition preprocessor symbol is defined, and specified in
3147 the \l {defines-variable} {defines} variable in the configuration
3148 file to make QDoc process the code within #ifdef and #endif:
3149
3150 \badcode
3151 defines = opensourceedition
3152 \endcode
3153
3154 You can also define the preprocessor symbol manually on the
3155 command line. For more information see the documentation of the \l
3156 {defines-variable} {defines} variable.
3157
3158 See also \l{endif-command} {\\endif}, \l{else-command} {\\else},
3159 \l {defines-variable} {defines} and \l {falsehoods-variable}
3160 {falsehoods}.
3161
3162 \target endif-command
3163 \section1 \\endif
3164
3165 The \\endif command and the corresponding \\if command
3166 enclose parts of a QDoc comment that will be included if
3167 the condition specified by the \l {if-command} {\\if} command's
3168 argument is true.
3169
3170 For more information, see the documentation of the \l {if-command}
3171 {\\if} command.
3172
3173 See also \l{if-command} {\\if}, \l{else-command} {\\else}, \l
3174 {defines-variable} {defines} and \l {falsehoods-variable}
3175 {falsehoods}.
3176
3177 \target else-command
3178 \section1 \\else
3179
3180 The \\else command specifies an alternative if the
3181 condition in the \l {if-command} {\\if} command is false.
3182
3183 The \\else command can only be used within \l {if-command}
3184 {\\if...\\endif} commands, but is useful when there is only two
3185 alternatives.
3186
3187 \target include-command
3188 \section1 \\include
3189
3190 The \\include command sends all or part of the file specified by
3191 its first argument to the QDoc input stream to be processed as a
3192 QDoc comment snippet.
3193
3194 The command is useful when some snippet of commands or text is to
3195 be used in multiple places in the documentation. Use the \\include
3196 command wherever you want to insert a snippet into the documentation.
3197 The file containing the snippet to include, must be located under the
3198 path(s) listed in the \l{sourcedirs-variable}{sourcedirs} or
3199 \l{exampledirs-variable}{exampledirs} QDoc configuration variable.
3200 It can be either any source file parsed by QDoc (or even the same one
3201 where \\include command is used), or any other text file. To store
3202 snippets in a separate file that is not meant to be parsed by QDoc,
3203 use a file extension that is not listed in
3204 \l{sources.fileextensions-variable}{sources.fileextensions};
3205 for example, \c .qdocinc.
3206
3207 The command can have one or more arguments. The first
3208 argument is always a file name. The contents of the file must be
3209 QDoc input, in other words, a sequence of QDoc commands and text, but
3210 without the enclosing QDoc comment \c{/}\c{*!} ... \c{*}\c{/} delimiters.
3211 If you want to include the entire named file, leave the second argument
3212 empty. If you want to include only part of the file, see the
3213 \l{2-argument-form}{two argument form} below. Here is an example
3214 of the one argument form:
3215
3216 \badcode *
3217 /\1!
3218 \page corefeatures.html
3219 \title Core Features
3220
3221 \include examples/signalandslots.qdocinc
3222 \include examples/objectmodel.qdocinc
3223 \include examples/layoutmanagement.qdocinc
3224 \1/
3225 \endcode
3226
3227
3228 \target 2-argument-form
3229 \section2 \\include filename snippet-identifier
3230
3231 It is a waste of time to make a separate \c .qdocinc file for every
3232 QDoc include snippet you want to use in multiple places in the
3233 documentation, especially given that you probably have to put the
3234 copyright/license notice in every one of these files. If you
3235 have multiple snippets to be included, you can put them all in a
3236 single file and surround each one with:
3237
3238 \badcode
3239 //! [snippet-id1]
3240
3241 QDoc commands and text...
3242
3243 //! [snippet-id1]
3244
3245 //! [snippet-id2]
3246
3247 More QDoc commands and text...
3248
3249 //! [snippet-id2]
3250 \endcode
3251
3252 Then you can use the two-argument form of the command:
3253
3254 \badcode
3255 \include examples/signalandslots.qdocinc snippet-id2
3256 \include examples/objectmodel.qdocinc another-snippet-id
3257 \endcode
3258
3259 The sequence of QDoc commands and text found between the two tags
3260 with the same name as the second argument is sent to the QDoc input
3261 stream. You can even have nested snippets.
3262
3263 \note Snippet identifiers work also within documentation comment
3264 (\beginqdoc .. \endqdoc) blocks, so it's not necessary to use a
3265 separate \c .qdocinc file. When processing a comment block, QDoc
3266 removes any \c {//!} comment lines from the generated output.
3267
3268 \section2 Extra arguments
3269
3270 Since QDoc 6.3, any further arguments passed to the \\include command
3271 are used for injecting strings into the included content. To inject a
3272 string to a specific location in the content, add a backslash followed
3273 by a digit (1..9). The digits correspond with the order of the argument
3274 list. Enclose arguments in curly braces to ensure that QDoc renders the
3275 entire argument, including possible whitespace characters, as you expect.
3276
3277 \important Each additional argument (including the snippet ID) must be
3278 enclosed in braces. If you want to include the entire file,
3279 use an empty snippet ID: \c {{}}.
3280
3281 For example, given the following snippet in a file \c includes.qdocinc:
3282
3283 \badcode
3284 //! [usage]
3285 To enable \e{\1}, select \uicontrol {\2} > \uicontrol Enable.
3286 //! [usage]
3287 \endcode
3288
3289 Then, the following \\include line:
3290
3291 \badcode
3292 \include includes.qdocinc {usage} {detailed output} {Verbose}
3293 \endcode
3294
3295 Renders
3296 \quotation
3297 To enable \e {detailed output}, select \uicontrol {Verbose} >
3298 \uicontrol Enable.
3299 \endquotation
3300
3301 \target meta-command
3302 \section1 \\meta
3303
3304 The \\meta command is used for adding metadata to documentation.
3305 The command has two arguments: the first argument is the name of the
3306 metadata attribute, and the second argument is the value for the attribute.
3307 Each argument should be enclosed in curly brackets, as shown in this
3308 example:
3309
3310 \badcode *
3311 /\1!
3312 \example demos/coffee
3313 \title Coffee Machine
3314 \brief A Qt Quick application with a state-based custom user interface.
3315
3316 \meta {tags} {quick,embedded,states,touch}
3317 \meta {category} {Application Examples}
3318 \1/
3319 \endcode
3320
3321 A number of metadata attributes have a specific purpose:
3322
3323 \b {Example Metadata}
3324
3325 Another use for \\meta command is to include metadata (tags) in
3326 \l {example-command}{\\example} documentation. By default, QDoc
3327 generates example tags based on the example's \l {title-command}{\\title}
3328 and module name. These tags are displayed in Qt Creator's Welcome mode,
3329 helping users navigate the list of examples.
3330
3331 Additional tags can be created with \c {\meta {tag} {tag1}}
3332 or \c {\meta {tags} {tag1,[tag2,...]}}.
3333 For example:
3334
3335 \badcode *
3336 /\1!
3337 \example helloworld
3338 \title Hello World Example
3339 \meta {tags} {tutorial,basic}
3340 \1/
3341 \endcode
3342
3343 This would result in the following tags: \e {tutorial,basic,hello,world}.
3344 Common words such as \e example are ignored.
3345
3346 \b {Excluding Examples}
3347
3348 Marking an example \e broken will exclude it from the generated manifest
3349 file, effectively removing it from Qt Creator's Welcome mode.
3350
3351 \badcode
3352 \meta {tag} {broken}
3353 \endcode
3354
3355 \b {Example Install Paths}
3356
3357 The \\meta command combined with an argument \c installpath specifies the
3358 location of an installed example. This value overrides the one that is set
3359 using the \c examplesinstallpath configuration variable.
3360
3361 \badcode *
3362 /\1!
3363 \example helloworld
3364 \title Hello World Example
3365 \meta {installpath} {tutorials}
3366 \1/
3367 \endcode
3368
3369 See also \l {examplesinstallpath}.
3370
3371 \b {Status}
3372
3373 A \c status argument for the \\meta command adds a custom status description
3374 for a \l {class-command}{\\class} or a \l {qmltype-command}{\\qmltype}. This
3375 description will then appear in a table at the top of the type reference page.
3376
3377 \badcode *
3378 /\1!
3379 \class QNativeInterface::QAndroidApplication
3380 \meta {status} {Android-specific}
3381 \1/
3382 \endcode
3383
3384 See also \l {Status}{status-related commands}.
3385
3386 \b {Document metadata}
3387
3388 A \c keywords argument for the \\meta command adds specified keywords
3389 as metadata for the generated document:
3390
3391 \code [text]
3392 \meta {keywords} {reference, internal}
3393 \endcode
3394
3395 In HTML output, these keywords are generated as a
3396 \c {<meta name="keywords" content="...">} element.
3397
3398 \target noautolist-command
3399 \section1 \\noautolist
3400
3401 The \\noautolist command indicates that the annotated list of C++
3402 classes or QML types, which is automatically generated at the
3403 bottom of the C++ or QML module page should be omitted, because
3404 the classes or types have been listed manually. This command can
3405 also be used with the \l {group-command}{\\group} command to omit
3406 the list of group members, when they are listed manually.
3407
3408 The command must stand on its own line. See \l {Qt Quick Controls QML Types}
3409 for an example. The page is generated from \c {qtquickcontrols2-qmlmodule.qdoc}.
3410 There you will find a QDoc comment containing the \c{\qmlmodule} command for
3411 the QtQuick.Controls module. The same comment contains a \c {\noautolist}
3412 command to disable automatic list generation, and a \l {generatelist-command}
3413 {\\generatelist} to list the QML types in a specific section of the document.
3414
3415 This command was introduced in QDoc 5.6.
3416
3417 Since Qt 5.10, this command can be applied also to \l{example-command}
3418 {\\example} documentation, where it causes the automatically generated
3419 list of files and images belonging to an example project to be omitted.
3420
3421 \target omit-command
3422 \section1 \\omit
3423
3424 The \\omit command and the corresponding \\endomit command
3425 delimit parts of the documentation that you want QDoc to skip. For
3426 example:
3427
3428 \badcode *
3429 /\1!
3430 \table
3431 \row
3432 \li Basic Widgets
3433 \li Basic GUI widgets such as buttons, comboboxes
3434 and scrollbars.
3435
3436 \omit
3437 \row
3438 \li Component Model
3439 \li Interfaces and helper classes for the Qt
3440 Component Model.
3441 \endomit
3442
3443 \row
3444 \li Database Classes
3445 \li Database related classes, e.g. for SQL databases.
3446 \endtable
3447 \1/
3448 \endcode
3449
3450 \target raw-command
3451 \section1 \\raw (avoid!)
3452
3453 The \\raw command and the corresponding
3454 \\endraw command delimit a block of raw mark-up language code.
3455
3456 \warning Avoid using this command if possible. If you are trying to
3457 generate special table or list behavior, try to get the behavior you want
3458 using the \l {span-command} {\\span} and \l {div-command} {\\div}
3459 commands in your \l {table-command} {\\table} or \l {list-command}
3460 {\\list}.
3461
3462 The command takes an argument specifying the code's format.
3463
3464 QDoc generates the given code only when generating the format that
3465 was specified by the user.
3466
3467 For example, "\\raw HTML" will only generate code when QDoc
3468 generates HTML documentation.
3469
3470 \note You can often achieve the intended purpose by using QDoc commands,
3471 while reducing the chance of mistakes or content becoming unmaintained.
3472
3473 \target sincelist-command
3474 \section1 \\sincelist
3475
3476 The \\sincelist command expands to a detailed breakdown of new
3477 inclusions to the documented API in a specified version. Example
3478 usage:
3479
3480 \badcode * \QtMajorVersion \QtMinorVersion \QtVer
3481 /\1!
3482 \page newclasses\2\3.html
3483 \title New Classes and Functions in \4
3484 \brief A comprehensive list of new classes and functions in \4.
3485
3486 \sincelist \4
3487 \1/
3488 \endcode
3489
3490 \\sincelist takes a single argument, a version string. The generated
3491 output includes all functionality that is marked with a
3492 \l {since-command}{\\since} command or a \l {since clause} matching
3493 the version string.
3494
3495 \target unicode-command
3496 \section1 \\unicode
3497
3498 The \\unicode command allows you to insert an arbitrary Unicode
3499 character in the document.
3500
3501 The command takes an argument specifying the character as an
3502 integer. By default, base 10 is assumed, unless a '0x' or '0'
3503 prefix is specified (for base 16 and 8, respectively).
3504*/