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