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
\code [text]
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
\code [text]
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
\code [text] *
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
\code [text] *
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
\code [text] *
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
\code [text]
1713
\l {Qt} {Qt C++ namespace}
1714
\endcode
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
\code [text]
1721
\l [QML] {Qt} {Qt QML type}
1722
\endcode
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
1739
\code [text]
1740
\l [QML|CPP|DOC|attached|QtModuleName] {link target} {link text}
1741
\endcode
1742
1743
The \e {square bracket} argument is only allowed in the \c {\l
1744
(link)} command. The example above shows how \c QML is used as the
1745
\e {square brackets} argument to force QDoc to match a QML target.
1746
Most often, this will be a QML type, but it can also be a QML
1747
member function or property. Additionally, some QML types contain
1748
properties and attached properties with the same name. Attached
1749
properties can be selected with an \c attached argument.
1750
If \c attached is omitted, regular properties will be linked to
1751
in preference to attached properties with duplicate names.
1752
1753
In the example, QDoc didn't need a \e {square bracket} argument to
1754
find the Qt C++ namespace page, because that one was the first
1755
matching target QDoc found anyway. However, to force QDoc to find
1756
a C++ target when a matching QML target gets in the way, \c CPP
1757
can be used as the \e {square bracket} argument. For example, the
1758
following link will force QDoc to ignore the Qt QML type and continue
1759
searching until it matches the Qt C++ namespace.
1760
1761
\code [text]
1762
\l [CPP] {Qt} {Qt C++ namespace}
1763
\endcode
1764
1765
If the link target is neither a C++ nor a QML entity, \c {DOC} can
1766
be used as the \e {square bracket} argument to prevent QDoc from
1767
matching either of those. At this writing, there were no cases of
1768
ambiguous links where using \c {DOC} was required.
1769
1770
Often, the documentor knows which Qt module the link target is
1771
in. When the module name is known, use the module name as the \e
1772
{square bracket} argument. In the example above, if we know that
1773
the QML type named Qt is located in the QtQml module, we can write
1774
the link command like this:
1775
1776
\code [text]
1777
\l [QtQml] {Qt} {Qt QML type}
1778
\endcode
1779
1780
When a module name is used as the \e {square bracket} argument,
1781
QDoc will search for the link target in that module only. This
1782
makes searching for link targets more efficient.
1783
1784
Finally, the module name and entity type arguments can be
1785
combined, separated by a blank, so something like this is also
1786
allowed:
1787
1788
\code [text]
1789
\l [CPP QtQml] {Window} {C++ class Window}
1790
\endcode
1791
1792
As of this writing, there were no cases where combining the two
1793
was required.
1794
1795
See also \l {sa-command} {\\sa}, \l {target-command} {\\target},
1796
and \l {keyword-command} {\\keyword}.
1797
1798
1799
\target sa-command
1800
\section1 \\sa (see also)
1801
1802
The \\sa command defines a list of links that will be rendered in
1803
a separate "See also" section at the bottom of the documentation
1804
unit.
1805
1806
The command takes a comma-separated list of links as its
1807
argument. If the line ends with a comma, you can continue
1808
the list on the next line. The general syntax is:
1809
1810
\code [text]
1811
\sa {the first link}, {the second link},
1812
{the third link}, ...
1813
\endcode
1814
1815
QDoc will automatically try to generate "See also" links
1816
interconnecting a property's various functions. For example, a
1817
setVisible() function will automatically get a link to visible()
1818
and vice versa.
1819
1820
In general, QDoc will generate "See also" links that interconnect
1821
the functions that access the same property. It recognizes four
1822
different syntax versions:
1823
1824
\list
1825
\li \c property()
1826
\li \c setProperty()
1827
\li \c isProperty()
1828
\li \c hasProperty()
1829
\endlist
1830
1831
The \\sa command supports the same kind of links as the \l
1832
{l-command} {\\l} command.
1833
1834
\badcode *
1835
/\1!
1836
Appends the actions \a actions to this widget's
1837
list of actions.
1838
1839
\sa removeAction(), QMenu, addAction()
1840
\1/
1841
void QWidget::addActions(QList<QAction *> actions)
1842
{
1843
...
1844
}
1845
\endcode
1846
1847
See also \l {l-command} {\\l}, \l {target-command} {\\target} and
1848
\l {keyword-command} {\\keyword}.
1849
1850
1851
\target target-command
1852
\section1 \\target
1853
1854
The \\target command names a place in the documentation that you
1855
can link to using the \l {l-command} {\\l (link)} and \l
1856
{sa-command} {\\sa (see also)} commands.
1857
1858
\e{The text up to the line break becomes the target name}. Be sure
1859
to follow the target name with a line break. Curly brackets are not
1860
required around the target name, but they may be required when the
1861
target name is used in a link command. See below.
1862
1863
\code [text] *
1864
/\1!
1865
\target capturing parentheses
1866
\section1 Capturing Text
1867
1868
Parentheses allow us to group elements together so that
1869
we can quantify and capture them.
1870
1871
...
1872
\1/
1873
\endcode
1874
1875
The target name \e{capturing parentheses} can be linked to
1876
in the following way:
1877
1878
\list
1879
\li \c {\l {capturing parentheses}}
1880
\endlist
1881
1882
Above, the target name is enclosed in brackets because it contains
1883
spaces.
1884
1885
\note The \\target command does not support \qdocvar macro expansion
1886
in its argument.
1887
1888
\section2 \\target in a \\table
1889
When you use the \\target command in a table, make sure that the
1890
\\target command follows a \l {li-command}{\\li}-command (table
1891
cell), as some generators only support targets to an individual cell,
1892
not to a whole row.
1893
Moreover, ensure that it's either on a separate line, or the last content
1894
that occurs in the line it's in. This is due to how the \\target
1895
command works; it consumes anything up to the next line break as
1896
its parameter. In other words, if you have a table and need a
1897
\\target within it, make sure that it follows the following
1898
structure:
1899
1900
\badcode
1901
\table
1902
\row
1903
\li \target my-target
1904
My text goes here.
1905
\li This is my next table cell.
1906
\endtable
1907
\endcode
1908
1909
See also \l {l-command} {\\l}, \l {sa-command} {\\sa} and \l
1910
{keyword-command} {\\keyword}.
1911
1912
\target keyword-command
1913
\section1 \\keyword
1914
1915
The \\keyword command names a place in the documentation that you
1916
can link to using the \l {l-command} {\\l (link)} and \l
1917
{sa-command} {\\sa (see also)} commands. It also adds the keyword
1918
and the location to generated indices.
1919
1920
The \\keyword command is like the \l {target-command} {\\target}
1921
command, except that when linking to a keyword, by default the link
1922
goes to the top of the QDoc comment (topic) the \\keyword appears in.
1923
1924
If you want to create a keyword for a \c section unit within a
1925
topic, add the \\keyword directly above the section title:
1926
1927
\badcode
1928
\keyword debug
1929
\section1 Debug command line option (--debug)
1930
...
1931
\endcode
1932
1933
Unlike \\target, keywords are registered in indices of generated
1934
offline documentation files (.qch). This allows users to look up the
1935
location by keyword, for instance, in
1936
\l[QtAssistant]{Searching for Keywords}{Qt Assistant's Index Search},
1937
and makes the keyword accessible in \QC's context help.
1938
1939
Keywords must be unique over all the documents processed during
1940
the QDoc run. The command uses the rest of the line as its
1941
argument. Be sure to follow the keyword with a line break.
1942
1943
1944
\badcode *
1945
/\1!
1946
\class QRegularExpression
1947
\reentrant
1948
\brief The QRegularExpression class provides pattern
1949
matching using regular expressions.
1950
\ingroup tools
1951
\ingroup misc
1952
\ingroup shared
1953
1954
\keyword regular expression
1955
1956
Regular expressions, or "regexps", provide a way to
1957
find patterns within text.
1958
1959
...
1960
\1/
1961
\endcode
1962
1963
The location marked with the keyword can be linked to with:
1964
1965
\badcode *
1966
/\1!
1967
When a string is surrounded by slashes, it is
1968
interpreted as a \l {regular expression}.
1969
\1/
1970
\endcode
1971
1972
If the keyword text contains spaces, the brackets are required.
1973
1974
\note The \\keyword command does not support \qdocvar macro expansion
1975
in its argument.
1976
1977
See also \l {l-command} {\\l (link)}, \l {sa-command} {\\sa (see
1978
also)} and \l {target-command} {\\target}.
1979
1980
*/
1981
1982
1983
/*!
1984
\page 09-qdoc-commands-includingimages.html
1985
\previouspage Creating Links
1986
\nextpage Tables and Lists
1987
1988
\title Including Images
1989
1990
The graphic commands makes it possible to include images in the
1991
documentation. The images can be rendered as separate paragraphs,
1992
or within running text.
1993
1994
\target image-command
1995
\section1 \\image
1996
1997
The \\image command expands to the image specified by its first
1998
argument, and renders it centered as a separate paragraph.
1999
2000
The command takes two arguments. The first argument is the name of
2001
the image file. The second argument is a description of what
2002
the image contains, and is used for the HTML \c alt attribute.
2003
Its contents is read aloud by screen readers, and its use is therefore
2004
strongly recommended for accessibility purposes. It may also be used by
2005
browsers that don't support images, like the Lynx text browser. You
2006
can also set the \l {usealttextastitle-variable} {usealttextastitle}
2007
variable to make QDoc generate a \e title attribute for the image, which
2008
commonly is rendered by graphical text browsers as a tooltip when the user
2009
hovers the mouse over the image.
2010
2011
While QDoc is quite forgiving, you should wrap both the file name and the
2012
description in curly braces, like so:
2013
\badcode
2014
\image {Bandit.png} {A Golden Retriever holding a bag of coffee in its mouth}
2015
\endcode
2016
This syntax is the most explicit and should always give the expected result.
2017
If not, be sure to follow the file name or the description with a line break.
2018
Curly brackets are required if the description argument spans multiple lines.
2019
If the description is wrapped in double quotes, QDoc will remove them before
2020
generating output. Special characters may be replaced with the corresponding
2021
HTML entity code in QDoc's HTML output.
2022
2023
\badcode *
2024
/\1!
2025
Qt is a C++ toolkit for cross-platform GUI application development.
2026
2027
\image {happyguy.jpg} {Happy guy}
2028
2029
Qt provides single-source portability across Microsoft
2030
Windows, macOS, Linux, and all major commercial Unix
2031
variants. It is also available for embedded devices.
2032
\1/
2033
\endcode
2034
2035
See also \l {inlineimage-command} {\\inlineimage} and \l
2036
{caption-command} {\\caption}.
2037
2038
\target inlineimage-command
2039
\section1 \\inlineimage
2040
2041
The \\inlineimage command expands to the image specified by its
2042
argument. The image is rendered inline with the rest of the text.
2043
2044
The command takes two arguments. The first argument is the name of
2045
the image file. The second argument is optional and is a simple
2046
description of the image within braces {}, equivalent to the HTML
2047
alt="" in an image tag. The description is used for tooltips, and
2048
for when a browser doesn't support images, like the Lynx text browser.
2049
2050
The most common use of the \\inlineimage command is in lists and
2051
tables. Here is an example of including inline images in a list:
2052
2053
\badcode *
2054
/\1!
2055
\list 1
2056
\li \inlineimage happy.gif {Oh so happy, I am a caption!}
2057
\li \inlineimage happy.gif Oh so happy, but I'm not a caption.
2058
\endlist
2059
\1/
2060
\endcode
2061
2062
Here is an example of including inline images in a table:
2063
2064
\badcode *
2065
/\1!
2066
\table
2067
\header
2068
\li Qt
2069
\li Qt Creator
2070
\row
2071
\li \inlineimage happy.gif {Oh so happy!}
2072
\li \inlineimage happy.gif Oh so happy!
2073
\row
2074
\li \inlineimage happy.gif Oh so happy!
2075
\li \inlineimage happy.gif {Oh so happy!}
2076
\endtable
2077
\1/
2078
\endcode
2079
2080
The command can also be used to insert an image inline with the
2081
text.
2082
2083
\badcode *
2084
/\1!
2085
\inlineimage training.jpg {Qt Training} The Qt Programming course is
2086
offered as a five day Open Enrollment Course. The classes are open to
2087
the public. Although the course is open to anyone who wants to learn,
2088
attendees should have significant experience in C++ development to
2089
derive maximum benefit from the course.
2090
\1/
2091
\endcode
2092
2093
See also \l {image-command} {\\image} and \l {caption-command} {\\caption}.
2094
2095
\target caption-command
2096
\section1 \\caption
2097
2098
The \\caption command provides a caption for an image.
2099
2100
The command takes all the text up to the end of the paragraph to
2101
be the caption. Experiment until you get the effect you want.
2102
2103
\badcode *
2104
/\1!
2105
\table 100%
2106
\row
2107
\li \image windows-pushbutton.png
2108
\caption The QPushButton widget provides a command button.
2109
\li \image windows-toolbutton.png
2110
\caption The QToolButton class provides a quick-access button to commands
2111
or options, usually used inside a QToolBar.
2112
\endtable
2113
\1/
2114
\endcode
2115
2116
See also \l {image-command} {\\image} and \l {inlineimage-command}
2117
{\\inlineimage}
2118
*/
2119
2120
2121
/*!
2122
\page 10-qdoc-commands-tablesandlists.html
2123
\previouspage Including Images
2124
\nextpage Special Content
2125
2126
\title Tables and Lists
2127
2128
These commands enable creating lists and tables. A list is
2129
rendered left aligned as a separate paragraph. A table is rendered
2130
centered as a separate paragraph. The table width depends on the
2131
width of its contents.
2132
2133
\target table-command
2134
\section1 \\table
2135
2136
The \\table and \\endtable commands delimit the contents of a
2137
table.
2138
2139
The command accepts a single argument specifying the table's width
2140
as a percentage of the page width:
2141
2142
\badcode *
2143
/\1!
2144
\table 100%
2145
2146
...
2147
2148
\endtable
2149
\1/
2150
\endcode
2151
2152
The code above ensures that the table will fill all available
2153
space. If the table's width is smaller than 100 %, the table will
2154
be centered in the generated documentation.
2155
2156
A table can contain headers, rows and columns. A row starts with a
2157
\l {row-command} {\\row} command and consists of cells, each of which
2158
starts with an \l {li-command} {\\li} command. There is also a \l
2159
{header-command} {\\header} command which is a special kind of row
2160
that has a special format.
2161
2162
\code [text] *
2163
/\1!
2164
\table
2165
\header
2166
\li Qt Core Feature
2167
\li Brief Description
2168
\row
2169
\li \l {Signal and Slots}
2170
\li Signals and slots are used for communication
2171
between objects.
2172
\row
2173
\li \l {Layout Management}
2174
\li The Qt layout system provides a simple
2175
and powerful way of specifying the layout
2176
of child widgets.
2177
\row
2178
\li \l {Drag and Drop}
2179
\li Drag and drop provides a simple visual
2180
mechanism which users can use to transfer
2181
information between and within applications.
2182
\endtable
2183
\1/
2184
\endcode
2185
2186
You can also make cells span several rows and columns. For
2187
example:
2188
2189
\code [text] *
2190
/\1!
2191
\table
2192
\header
2193
\li {3,1} This header cell spans three columns,
2194
but only one row.
2195
\row
2196
\li {2, 1} This table cell spans two columns,
2197
but only one row
2198
\li {1, 2} This table cell spans only one column,
2199
but two rows.
2200
\row
2201
\li A regular table cell
2202
\li A regular table cell
2203
\endtable
2204
\1/
2205
\endcode
2206
2207
See also \l {header-command} {\\header}, \l {row-command} {\\row} and \l {li-command} {\\li}.
2208
2209
\target header-command
2210
\section1 \\header
2211
2212
The \\header command indicates that the following table cells are
2213
the current table's column headers.
2214
2215
The command can only be used within the \l{table-command}
2216
{\\table...\\endtable} commands. A header can contain several
2217
cells. A cell is created with the \l {li-command} {\\li} command.
2218
2219
A header cell's text is centered within the table cell and
2220
rendered using a bold font.
2221
2222
\code [text] *
2223
/\1!
2224
\table
2225
\header
2226
\li Qt Core Feature
2227
\li Brief Description
2228
\row
2229
\li \l {Signal and Slots}
2230
\li Signals and slots are used for communication
2231
between objects.
2232
\endtable
2233
\1/
2234
\endcode
2235
2236
See also \l {table-command} {\\table}, \l {row-command} {\\row} and \l {li-command} {\\li}.
2237
2238
\target row-command
2239
\section1 \\row
2240
2241
The \\row command begins a new row in a table. The \l {li-command}
2242
{\\li items} that belong in the new row will immediately follow the
2243
\\row.
2244
2245
The command can only be used within the \l{table-command}
2246
{\\table...\\endtable} commands. A row can contain several
2247
cells. A cell is created with the \l {li-command} {\\li} command.
2248
2249
The background cell color of each row alternates between two
2250
shades of grey, making it easier to distinguish the rows from each
2251
other. The cells' contents is left aligned.
2252
2253
\code [text] *
2254
/\1!
2255
\table
2256
\header
2257
\li Qt Core Feature
2258
\li Brief Description
2259
\row
2260
\li \l {Signal and Slots}
2261
\li Signals and slots are used for communication
2262
between objects.
2263
\row
2264
\li \l {Layout Management}
2265
\li The Qt layout system provides a simple
2266
and powerful way of specifying the layout
2267
of child widgets.
2268
\row
2269
\li \l {Drag and Drop}
2270
\li Drag and drop provides a simple visual
2271
mechanism which users can use to transfer
2272
information between and within applications.
2273
\endtable
2274
\1/
2275
\endcode
2276
2277
See also \l {table-command} {\\table}, \l {header-command}
2278
{\\header}, and \l {li-command} {\\li}.
2279
2280
\target value-command
2281
\section1 \\value
2282
2283
The \\value command starts the documentation of a C++ enum item.
2284
2285
The command's first argument is the value name. The value name may
2286
be preceded by an optional \e since clause enclosed in square
2287
brackets. The value description follows the value name. The description
2288
ends at the next blank line or \\value. The arguments are rendered in a
2289
table.
2290
2291
\note To include images in the \\value description, use the
2292
\l {inlineimage-command}{\\inlineimage} command.
2293
2294
Without a \e since clause, a \\value command could look like this:
2295
2296
\code
2297
\value QtInfoMsg A message generated by the qInfo() function.
2298
\endcode
2299
2300
The same command with a \e since clause would look like this:
2301
2302
\code
2303
\value [since 5.5] QtInfoMsg A message generated by the qInfo() function.
2304
\endcode
2305
2306
The documentation will be located in the associated class, header
2307
file or namespace documentation. See the \l {enum-command}
2308
{\\enum} documentation for an example.
2309
2310
\note Since Qt 5.4, \\value command can also be used outside the
2311
\l {enum-command} {\\enum} topic. In this case, QDoc renders a
2312
two-column table listing the constant name (taken as-is from the
2313
first argument) and its description. This can be used, for
2314
example, in \l {qmlproperty-command}{\\qmlproperty} topic for
2315
documenting acceptable values for a QML enumeration property.
2316
2317
See also \l {enum-command} {\\enum} and \l {omitvalue-command} {\\omitvalue}.
2318
2319
\target omitvalue-command
2320
\section1 \\omitvalue
2321
2322
The \\omitvalue command excludes a C++ enum item from the
2323
documentation.
2324
2325
The command's only mandatory argument is the name of the enum item
2326
that will be omitted. If the enum item is followed by a single-line
2327
description, that is also omitted.
2328
2329
See the \l {enum-command} {\\enum} documentation for an example.
2330
2331
See also \l {enum-command} {\\enum} and \l {value-command}
2332
{\\value} \l {since-command}{\\since}
2333
2334
\target list-command
2335
\section1 \\list
2336
2337
The \\list and \\endlist commands delimit a list of items.
2338
2339
Create each list item with the \l {li-command} {\\li} command. A
2340
list always contains one or more items. Lists can be nested. For
2341
example:
2342
2343
\code [text] *
2344
/\1!
2345
\list
2346
\li Qt Reference Documentation: Getting Started
2347
\list
2348
\li How to Learn Qt
2349
\li Installation
2350
\list
2351
\li Qt/X11
2352
\li Qt/Windows
2353
\li Qt/Mac
2354
\li Qt/Embedded
2355
\endlist
2356
\li Tutorial and Examples
2357
\endlist
2358
\endlist
2359
\1/
2360
\endcode
2361
2362
The \\list command takes an optional argument providing
2363
alternative appearances for the list items.
2364
2365
\code [text] *
2366
/\1!
2367
\list
2368
\li How to Learn Qt
2369
\li Installation
2370
\li Tutorial and Examples
2371
\endlist
2372
\1/
2373
\endcode
2374
2375
If you provide 'A' as an argument to the \\list command, the
2376
bullets are replaced with characters in alphabetical order:
2377
2378
\list A
2379
\li How to Learn Qt
2380
\li Installation
2381
\li Tutorial and Examples
2382
\endlist
2383
2384
If you replace 'A' with '1', the list items are numbered in
2385
ascending order:
2386
2387
\list 1
2388
\li How to Learn Qt
2389
\li Installation
2390
\li Tutorial and Examples
2391
\endlist
2392
2393
If you provide 'i' as the argument, the bullets are replaced with
2394
roman numerals:
2395
2396
\list i
2397
\li How to Learn Qt
2398
\li Installation
2399
\li Tutorial and Examples
2400
\endlist
2401
2402
Finally, you can make the list items appear with roman numbers
2403
following in ascending order if you provide 'I' as the optional
2404
argument:
2405
2406
\list I
2407
\li How to Learn Qt
2408
\li Installation
2409
\li Tutorial and Examples
2410
\endlist
2411
2412
You can also make the listing start at any character or number by
2413
simply provide the number or character you want to start at. For
2414
example:
2415
2416
\code [text] *
2417
/\1!
2418
\list G
2419
\li How to Learn Qt
2420
\li Installation
2421
\li Tutorial and Examples
2422
\endlist
2423
\1/
2424
\endcode
2425
2426
See also \l {li-command} {\\li}.
2427
2428
\target li-command
2429
\section1 \\li (table cell, list item)
2430
2431
The \\li command marks a table cell or a list item. This command
2432
is only used in \l{table-command} {tables} and \l{list-command}
2433
{lists}.
2434
2435
It considers everything as its argument until the next \\li command, until the
2436
next \l {table-command} {\\endtable}, or \l {list-command} {\\endlist}
2437
command. See \l {table-command} {\\table} and \l {list-command} {\\list}
2438
for examples.
2439
2440
If the command is used within a table, you can also specify
2441
how many rows or columns the item should span.
2442
2443
\code [text] *
2444
/\1!
2445
\table
2446
\header
2447
\li {3,1} This header cell spans three columns
2448
but only one row.
2449
\row
2450
\li {2, 1} This table item spans two columns
2451
but only one row
2452
\li {1, 2} This table item spans only one column,
2453
but two rows.
2454
\row
2455
\li A regular table item
2456
\li A regular table item
2457
\endtable
2458
\1/
2459
\endcode
2460
2461
If not specified, the item will span one column and one row.
2462
2463
See also \l {table-command} {\\table}, \l {header-command}
2464
{\\header}, and \l {list-command} {\\list}.
2465
2466
*/
2467
2468
2469
/*!
2470
\page 11-qdoc-commands-specialcontent.html
2471
\previouspage Tables and Lists
2472
\nextpage Miscellaneous
2473
2474
\title Special Content
2475
2476
The document contents commands identify parts of the documentation,
2477
parts with a special rendering, conceptual meaning or
2478
function.
2479
2480
\target quotation-command
2481
\section1 \\quotation
2482
2483
The \\quotation and \\endquotation commands delimit a long quotation.
2484
2485
The text in the delimited block is surrounded by
2486
\b{<blockquote>} and \b{</blockquote>} in the html output,
2487
e.g.:
2488
2489
\code [text] *
2490
/\1!
2491
Although the prospect of a significantly broader market is
2492
good news for Firstlogic, the notion also posed some
2493
challenges. Dave Dobson, director of technology for the La
2494
Crosse, Wisconsin-based company, said:
2495
2496
\quotation
2497
As our solutions were being adopted into new
2498
environments, we saw an escalating need for easier
2499
integration with a wider range of enterprise
2500
applications.
2501
\endquotation
2502
\1/
2503
\endcode
2504
2505
The text in the \b{\\quotation} block will appear in the generated HTML as:
2506
2507
\code [text]
2508
<blockquote>
2509
<p>As our solutions were being adopted into new environments,
2510
we saw an escalating need for easier integration with a wider
2511
range of enterprise applications.</p>
2512
</blockquote>
2513
\endcode
2514
2515
The built-in style sheet for most browsers will render the
2516
contents of the <blockquote> tag with left and right
2517
indentations. The example above would be rendered as:
2518
2519
\quotation
2520
As our solutions were being adopted into new
2521
environments, we saw an escalating need for easier
2522
integration with a wider range of enterprise
2523
applications.
2524
\endquotation
2525
2526
But you can redefine the \b{<blockquote>} tag in your style.css file.
2527
2528
2529
\target note-command
2530
\section1 \\note
2531
2532
The \\note command defines a new paragraph preceded by "Note:"
2533
in bold. The command takes a continuous paragraph as the argument,
2534
terminating after the end of the paragraph. The note command is only for
2535
shorter statements and not for longer multiline paragraphs.
2536
2537
Similar to the \l{warning-command}{\\warning} command, the note is for
2538
short and important statements. See
2539
\l{https://wiki.qt.io/Qt_Writing_Guidelines}{Qt Writing Guidelines} for
2540
usage information.
2541
2542
\target notranslate-command
2543
\section1 \\notranslate
2544
2545
The \\notranslate command indicates that its argument is \b not to be translated,
2546
when the generated output is passed to a language translation service.
2547
2548
Other commands (\qdoccmd {c}, \qdoccmd {tt}) have the same effect, but
2549
\\notranslate does not style its argument in any way.
2550
2551
This command was introduced in QDoc version 6.10.
2552
2553
\target brief-command
2554
\section1 \\brief
2555
2556
The \\brief command introduces a one-sentence description of
2557
any of the \l{Topic Commands}.
2558
2559
The brief text is used to introduce the documentation of the
2560
associated object, and in lists generated using the \l
2561
{generatelist-command} {\\generatelist} command and the \l
2562
{annotatedlist-command} {\\annotatedlist} command.
2563
2564
The brief text will be displayed in the documentation
2565
for that particular topic.
2566
2567
For example the boolean QWidget::isWindow property:
2568
2569
\code [text] *
2570
/\1!
2571
\property QWidget::isActiveWindow
2572
\brief Whether this widget's window is the active window.
2573
2574
The active window is the window that contains the widget that
2575
has keyboard focus.
2576
2577
When popup windows are visible, this property is \c true
2578
for both the active window \e and the popup.
2579
2580
\sa activateWindow(), QApplication::activeWindow()
2581
\1/
2582
\endcode
2583
2584
and the QWidget::geometry property
2585
2586
\code [text] *
2587
/\1!
2588
\property QWidget::geometry
2589
\brief The geometry of the widget relative to its parent and
2590
excluding the window frame.
2591
2592
When changing the geometry, the widget, if visible,
2593
receives a move event (moveEvent()) and/or a resize
2594
event (resizeEvent()) immediately.
2595
2596
...
2597
2598
\sa frameGeometry(), rect(), ...
2599
\1/
2600
\endcode
2601
2602
When the \\brief command is used to describe a class, we recommend
2603
using a complete sentence like this:
2604
2605
\code [text]
2606
The <classname> class is|provides|contains|specifies...
2607
\endcode
2608
2609
\warning Do not repeat your detailed description with the same sentence as
2610
the brief statement will be the first paragraph of the detailed
2611
description.
2612
2613
\code [text] *
2614
/\1!
2615
\class PreviewWindow
2616
\brief The PreviewWindow class is a custom widget
2617
displaying the names of its currently set
2618
window flags in a read-only text editor.
2619
2620
The PreviewWindow class inherits QWidget. The widget
2621
displays the names of its window flags set with the
2622
setWindowFlags() function. It is also provided with a
2623
QPushButton that closes the window.
2624
2625
...
2626
2627
\sa QWidget
2628
\1/
2629
\endcode
2630
2631
Using \\brief in a \l{namespace-command}{\\namespace}:
2632
2633
\code [text] *
2634
/\1!
2635
\namespace Qt
2636
2637
\brief The Qt namespace contains miscellaneous identifiers
2638
used throughout the Qt library.
2639
\1/
2640
\endcode
2641
2642
Using \\brief in a \l{headerfile-command}{\\headerfile}:
2643
2644
\code [text] *
2645
/\1!
2646
\headerfile <QtGlobal>
2647
\title Global Qt Declarations
2648
2649
\brief The <QtGlobal> header file provides basic
2650
declarations and is included by all other Qt headers.
2651
2652
\sa <QtAlgorithms>
2653
\1/
2654
\endcode
2655
2656
See also \l{property-command} {\\property}, \l{class-command}
2657
{\\class}, \l{namespace-command} {\\namespace} and
2658
\l{headerfile-command} {\\headerfile}.
2659
2660
\target legalese-command
2661
\section1 \\legalese
2662
2663
The \\legalese and \\endlegalese commands delimit a license agreement.
2664
2665
In the generated HTML, the delimited text is surrounded by a \b
2666
{<div class="LegaleseLeft">} and \b {</div>} tags.
2667
2668
An example of a license agreement enclosed in \\legalese
2669
and \\endlegalese:
2670
2671
\code [text] *
2672
/\1!
2673
\legalese
2674
Copyright 1996 Daniel Dardailler.
2675
2676
Permission to use, copy, modify, distribute, and sell this
2677
software for any purpose is hereby granted without fee,
2678
provided that the above copyright notice appear in all
2679
copies and that both that copyright notice and this
2680
permission notice appear in supporting documentation, and
2681
that the name of Daniel Dardailler not be used in
2682
advertising or publicity pertaining to distribution of the
2683
software without specific, written prior permission. Daniel
2684
Dardailler makes no representations about the suitability of
2685
this software for any purpose. It is provided "as is"
2686
without express or implied warranty.
2687
2688
Modifications Copyright 1999 Matt Koss, under the same
2689
license as above.
2690
\endlegalese
2691
\1/
2692
\endcode
2693
2694
It will appear in the generated HTML as:
2695
2696
\code [text]
2697
<div class="LegaleseLeft">
2698
<p>Copyright 1996 Daniel Dardailler.</p>
2699
<p>Permission to use, copy, modify, distribute, and sell
2700
this software for any purpose is hereby granted without fee,
2701
provided that the above copyright notice appear in all
2702
copies and that both that copyright notice and this
2703
permission notice appear in supporting documentation, and
2704
that the name of Daniel Dardailler not be used in
2705
advertising or publicity pertaining to distribution of the
2706
software without specific, written prior permission. Daniel
2707
Dardailler makes no representations about the suitability of
2708
this software for any purpose. It is provided "as is"
2709
without express or implied warranty.</p>
2710
2711
<p>Modifications Copyright 1999 Matt Koss, under the same
2712
license as above.</p>
2713
</div>
2714
\endcode
2715
2716
If the \\endlegalese command is omitted, QDoc will process the
2717
\\legalese command but considers the rest of the documentation
2718
page as the license agreement.
2719
2720
Ideally, the license text is located with the licensed code.
2721
2722
Elsewhere, the documentation identified as \e{\\legalese} command
2723
can be accumulated using \l {generatelist-command} {\\generatelist}
2724
with \c {legalese} as the argument. This is useful for generating
2725
an overview of the license agreements associated with the source
2726
code.
2727
2728
\note The output of the \c {\generatelist legalese} command includes
2729
the \\legalese texts in the current documentation project only. If
2730
the current documentation project depends on other modules, their
2731
license texts will not be listed.
2732
2733
\target warning-command
2734
\section1 \\warning
2735
2736
The \\warning command prepends "Warning:" to the command's
2737
argument, in bold font.
2738
2739
\code [text] *
2740
/\1!
2741
Qt::HANDLE is a platform-specific handle type
2742
for system objects. This is equivalent to
2743
\c{void *} on Windows and macOS, and to
2744
\c{unsigned long} on X11.
2745
2746
\warning Using this type is not portable.
2747
\1/
2748
\endcode
2749
*/
2750
2751
2752
/*!
2753
\page 12-0-qdoc-commands-miscellaneous.html
2754
\previouspage Special Content
2755
\nextpage The QDoc Configuration File
2756
2757
\title Miscellaneous
2758
2759
These commands provide miscellaneous functions connected to the
2760
visual appearance of the documentation, and to the process of
2761
generating the documentation.
2762
2763
\target annotatedlist-command
2764
\section1 \\annotatedlist
2765
2766
The \\annotatedlist command expands to a list of the members of a
2767
group, each member listed with its \e {brief} text. Below is an
2768
example from the Qt Reference Documentation:
2769
2770
\code [text] *
2771
/\1!
2772
...
2773
\section1 Drag and Drop Classes
2774
2775
These classes deal with drag and drop and the necessary mime type
2776
encoding and decoding.
2777
2778
\annotatedlist draganddrop
2779
\1/
2780
\endcode
2781
2782
This generates a list of all the C++ classes and/or QML types in
2783
the \e{draganddrop} group. A C++ class or QML type in the
2784
\e{draganddrop} group will have \e{\\ingroup draganddrop} in its
2785
\e{\\class} or \e{\\qmltype} comment.
2786
2787
The group members are sorted in ascending order, based on
2788
user-visible name or title. Since QDoc 6.8, \\annotatedlist
2789
and \qdoccmd generatelist support also custom sorting.
2790
2791
See also \qdoccmd generatelist and \l {Sorting group members}.
2792
2793
\target cmakepackage-command
2794
\section1 \\cmakepackage
2795
2796
Use the \\cmakepackage command to add CMake package information to classes
2797
and namespaces. This information will then appear in a table at the top of
2798
the class or namespace documentation page. For example:
2799
2800
\code [text] *
2801
/*!
2802
\namespace Foo
2803
\inheaderfile Bar
2804
\cmakepackage Baz
2805
\brief A namespace.
2806
2807
...
2808
\1/
2809
\endcode
2810
2811
QDoc will output this as
2812
2813
\quotation
2814
\raw HTML
2815
<h1 class="title">Foo Namespace</h1>
2816
<p>A namespace. <a>More...</a></p>
2817
<div class="table"><table class="alignedsummary">
2818
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <Bar></span></td></tr>
2819
<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>
2820
</table></div>
2821
\endraw
2822
\endquotation
2823
2824
\e{See also} \l{module-command}{\\module} and
2825
\l{cmakecomponent}{\\cmakecomponent}}
2826
2827
\target cmakecomponent-command
2828
\section1 \\cmakecomponent
2829
2830
Use the \\cmakecomponent command to add CMake component information to classes
2831
and namespaces. This information will then appear in a table at the top of
2832
the class or namespace documentation page. For example:
2833
2834
\code [text] *
2835
/*!
2836
\namespace Foo
2837
\inheaderfile Bar
2838
\cmakecomponent Baz
2839
\brief A namespace.
2840
2841
...
2842
\1/
2843
\endcode
2844
2845
QDoc will output this as
2846
2847
\quotation
2848
\raw HTML
2849
<h1 class="title">Foo Namespace</h1>
2850
<p>A namespace. <a>More...</a></p>
2851
<div class="table"><table class="alignedsummary">
2852
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <Bar></span></td></tr>
2853
<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>
2854
</table></div>
2855
\endraw
2856
\endquotation
2857
2858
\e{See also} \l{module-command}{\\module} and
2859
\l{cmakepackage}{\\cmakepackage}}
2860
2861
\target cmaketargetitem-command
2862
\section1 \\cmaketargetitem
2863
2864
Use the \\cmaketargetitem command to override the \e {item} part of the
2865
CMake \c{target_link_libraries} information that's added to classes and
2866
namespaces. The command must be used in conjunction with the
2867
\l{module-command}{\\module} and \l{cmakecomponent}{\\cmakecomponent}
2868
commands. For example:
2869
2870
\code [text] *
2871
/*!
2872
\namespace Foo
2873
\inheaderfile Bar
2874
\cmakecomponent Baz
2875
\cmaketargetitem Qt6::BazPrivate
2876
\brief A namespace.
2877
2878
...
2879
\1/
2880
\endcode
2881
2882
QDoc will output this as
2883
2884
\quotation
2885
\raw HTML
2886
<h1 class="title">Foo Namespace</h1>
2887
<p>A namespace. <a>More...</a></p>
2888
<div class="table"><table class="alignedsummary">
2889
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <Bar></span></td></tr>
2890
<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>
2891
</table></div>
2892
\endraw
2893
\endquotation
2894
2895
\e{See also} \l{module-command}{\\module} and
2896
\l{cmakecomponent}{\\cmakecomponent}}
2897
2898
2899
\target qtcmakepackage-command
2900
\section1 \\qtcmakepackage
2901
2902
Use the \\qtcmakepackage command to add CMake package information to classes
2903
and namespaces. This information will then appear in a table at the top of
2904
the class or namespace documentation page. For example:
2905
2906
\code [text] *
2907
/*!
2908
\namespace Foo
2909
\inheaderfile Bar
2910
\qtcmakepackage Baz
2911
\brief A namespace.
2912
2913
...
2914
\1/
2915
\endcode
2916
2917
QDoc will output this as
2918
2919
\quotation
2920
\raw HTML
2921
<h1 class="title">Foo Namespace</h1>
2922
<p>A namespace. <a>More...</a></p>
2923
<div class="table"><table class="alignedsummary">
2924
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <Bar></span></td></tr>
2925
<tr><td class="memItemLeft rightAlign topAlign"> CMake:</td><td class="memItemRight bottomAlign"> find_package(Qt6 REQUIRED COMPONENTS Baz)</td></tr>
2926
</table></div>
2927
\endraw
2928
\endquotation
2929
2930
2931
\target qtcmaketargetitem-command
2932
\section1 \\qtcmaketargetitem
2933
2934
Use the \\qtcmaketargetitem command to override the \e {item} part of the
2935
CMake \c{target_link_libraries} information that's added to classes and
2936
namespaces. The command must be used in conjunction with the
2937
\l{module-command}{\\module} and \l{qtcmakepackage}{\\qtcmakepackage}
2938
commands.
2939
2940
\e{See also} \l{module-command}{\\module} and
2941
\l{qtcmakepackage}{\\qtcmakepackage}}
2942
2943
2944
\target generatelist-command
2945
\section1 \\generatelist
2946
2947
The \\generatelist command expands to a list of links to the
2948
documentation entities grouped with an \l {ingroup-command}
2949
{\\ingroup} command or entities that match one of the arguments
2950
listed below. An example from the Qt Reference Documentation:
2951
2952
\code [text] *
2953
/\1!
2954
\page classes.html
2955
\title All Classes
2956
2957
For a shorter list that only includes the most
2958
frequently used classes, see \l{Qt's Main Classes}.
2959
2960
\generatelist classes Q
2961
\1/
2962
\endcode
2963
2964
This generates the \e {All Classes} page. The command accepts the
2965
following arguments:
2966
2967
\section2 \c {<group-name>}
2968
2969
With a group name as the only argument, QDoc lists all entities that
2970
use the \c {\ingroup <group-name>} command.
2971
2972
\section3 Sorting group members
2973
2974
When generating a list of group members, they are sorted in ascending
2975
order, based on user-visible name or title. Since QDoc 6.8, the default
2976
sort order can be modified:
2977
2978
\code [text]
2979
\generatelist [descending] changelogs
2980
\endcode
2981
2982
Assuming the \e changelogs group consists of pages
2983
detailing changes in different versions, this generates the
2984
list in descending order (newest version first).
2985
2986
\section4 Sort key
2987
2988
Since QDoc 6.8, a custom sort key can be assigned to one or
2989
more group members using the \qdoccmd meta command:
2990
2991
\code [text]
2992
\meta sortkey {sort key}
2993
\endcode
2994
2995
Sorting (ascending or descending) is then done based on
2996
these key(s), rather than user-visible titles.
2997
2998
\note Any group member with a sort key is listed \e before
2999
members without a key (in the default ascending order). This
3000
allows raising individual group member(s) to the top of the
3001
list.
3002
3003
\target table example
3004
\section2 \c annotatedclasses
3005
3006
The \c annotatedclasses argument provides a table containing the
3007
names of all the classes, and a description of each class. Each
3008
class name is a link to the class's reference documentation. For
3009
example:
3010
3011
\table
3012
\row
3013
\li QDial
3014
\li Rounded range control (like a speedometer or potentiometer)
3015
\row
3016
\li QDialog
3017
\li The base class of dialog windows
3018
\row
3019
\li QDir
3020
\li Access to directory structures and their contents
3021
\endtable
3022
3023
A C++ class is documented with the \l {class-command} {\\class}
3024
command. The annotation for the class is taken from the argument
3025
of the class comment's \l {brief-command} {\\brief} command.
3026
3027
\section2 \c annotatedexamples
3028
3029
The \c annotatedexamples argument provides a complete list of all
3030
examples as a set of tables containing the titles of all the
3031
examples, and a description of each example. Each title is a
3032
link to the example's documentation.
3033
3034
A separate table for each module (that has documented examples)
3035
is generated, provided that the module has defined a
3036
navigation.landingpage configuration variable. The \e landingpage
3037
variable is used as a title for a header that precedes each table.
3038
3039
\section2 \c annotatedattributions
3040
3041
The \c annotatedattributions argument provides a complete list of all
3042
attributions as a set of tables containing the titles of all the
3043
attributions, and a description of each attribution. Each title is a
3044
link to the attribution's page.
3045
3046
A separate table for each module (that has attributions)
3047
is generated, provided that the module has defined a
3048
navigation.landingpage configuration variable. The \e landingpage
3049
variable is used as a title for a header that precedes each table.
3050
3051
\target list example
3052
\section2 \c {classes <prefix>}
3053
3054
The \c classes argument provides a complete alphabetical list of
3055
the classes. The second argument, \c{<prefix>}, is the common
3056
prefix for the class names. The class names will be sorted on the
3057
character that follows the common prefix. e.g. The common prefix
3058
for the Qt classes is \c Q. The common prefix argument is
3059
optional. If no common prefix is provided, the class names will
3060
be sorted on their first character.
3061
3062
Each class name becomes a link to the class's reference
3063
documentation. This command is used to generate the
3064
\e {All Classes} page this way:
3065
3066
\code [text] *
3067
/\1!
3068
\page classes.html
3069
\title All Classes
3070
\ingroup classlists
3071
3072
\brief Alphabetical list of classes.
3073
3074
This is a list of all Qt classes. For classes that
3075
have been deprecated, see the \l{Obsolete Classes}
3076
list.
3077
3078
\generatelist classes Q
3079
\1/
3080
\endcode
3081
3082
A C++ class is documented with the \l {class-command} {\\class}
3083
command.
3084
3085
\section2 \c classesbymodule
3086
3087
When this argument is used, a second argument is required, which
3088
specifies the module whose classes are to be listed. QDoc
3089
generates a table containing those classes. Each class is listed
3090
with the text of its \l{brief-command} {\\brief} command.
3091
3092
For example, this command can be used on a module page as follows:
3093
3094
\code [text] *
3095
/\1!
3096
\page phonon-module.html
3097
\module Phonon
3098
\title Phonon Module
3099
\ingroup modules
3100
3101
\brief Contains namespaces and classes for multimedia functionality.
3102
3103
\generatelist{classesbymodule Phonon}
3104
3105
...
3106
\1/
3107
\endcode
3108
3109
Each class that is a member of the specified module must be marked
3110
with the \l {inmodule-command} {\\inmodule} command in its \\class
3111
comment.
3112
3113
\section2 \c qmltypesbymodule
3114
3115
Similar to \c classesbymodule argument, but used for listing the
3116
QML types (excluding QML value types) from the QML module specified
3117
with the second argument.
3118
3119
\note Support for this argument was introduced in QDoc 5.6.
3120
3121
\section2 \c qmlvaluetypesbymodule
3122
3123
Similar to \c qmltypesbymodule argument, but lists QML value
3124
types instead.
3125
3126
\note Support for this argument was introduced in QDoc 6.7.
3127
3128
\section2 \c functionindex
3129
3130
The \c functionindex argument provides a complete alphabetical
3131
list of all the documented member functions. It is normally used
3132
only to generate the \e {Qt function index} page
3133
this way:
3134
3135
\code [text] *
3136
/\1!
3137
\page functions.html
3138
\title All Functions
3139
\ingroup funclists
3140
3141
\brief All documented Qt functions listed alphabetically with a
3142
link to where each one is declared.
3143
3144
This is the list of all documented member functions and global
3145
functions in the Qt API. Each function has a link to the
3146
class or header file where it is declared and documented.
3147
3148
\generatelist functionindex
3149
\1/
3150
\endcode
3151
3152
\section2 \c legalese
3153
3154
The \c legalese argument tells QDoc to generate a list of licenses in
3155
the current documentation project. Each license is identified using
3156
the \l {legalese-command} {\\legalese} command.
3157
3158
\section2 \c overviews
3159
3160
The \c overviews argument is used to tell QDoc to generate a list
3161
by concatenating the contents of all the \l {group-command}
3162
{\\group} pages. Qt uses it to generate the \e {overviews} page
3163
this way:
3164
3165
\code [text] *
3166
/\1!
3167
\page overviews.html
3168
3169
\title All Overviews and HOWTOs
3170
3171
\generatelist overviews
3172
\1/
3173
\endcode
3174
3175
\section2 \c attributions
3176
3177
The \c attributions argument is used to tell QDoc to generate a list
3178
of attributions in the documentation.
3179
3180
\section2 \c related
3181
3182
The \c related argument is used in combination with the \l
3183
{group-command} {\\group} and \l {ingroup-command} {\\ingroup}
3184
commands to list all the overviews related to a specified
3185
group. For example, the page for the \e {Programming with Qt}
3186
page is generated this way:
3187
3188
\code [text] *
3189
/\1!
3190
\group qt-basic-concepts
3191
\title Programming with Qt
3192
3193
\brief The basic architecture of the Qt cross-platform application and UI framework.
3194
3195
Qt is a cross-platform application and UI framework for
3196
writing web-enabled applications for desktop, mobile, and
3197
embedded operating systems. This page contains links to
3198
articles and overviews explaining key components and
3199
techniuqes used in Qt development.
3200
3201
\generatelist {related}
3202
\1/
3203
\endcode
3204
3205
Each page listed on this group page contains the command:
3206
3207
\code
3208
\ingroup qt-basic-concepts
3209
\endcode
3210
3211
See also \qdoccmd {annotatedlist}.
3212
3213
\target if-command
3214
\section1 \\if
3215
3216
The \\if command and the corresponding \\endif command
3217
enclose parts of a QDoc comment that only will be included if
3218
the condition specified by the command's argument is true.
3219
3220
The command reads the rest of the line and parses it as an C++ #if
3221
statement.
3222
3223
\code [text] *
3224
/\1!
3225
\if defined(opensourceedition)
3226
3227
\note This edition is for the development of
3228
\l{Qt Open Source Edition} {Free and Open Source}
3229
software only; see \l{Qt Commercial Editions}.
3230
3231
\endif
3232
\1/
3233
\endcode
3234
3235
This QDoc comment will only be rendered if the \c
3236
opensourceedition preprocessor symbol is defined, and specified in
3237
the \l {defines-variable} {defines} variable in the configuration
3238
file to make QDoc process the code within #ifdef and #endif:
3239
3240
\code [text]
3241
defines = opensourceedition
3242
\endcode
3243
3244
You can also define the preprocessor symbol manually on the
3245
command line. For more information see the documentation of the \l
3246
{defines-variable} {defines} variable.
3247
3248
See also \l{endif-command} {\\endif}, \l{else-command} {\\else},
3249
\l {defines-variable} {defines} and \l {falsehoods-variable}
3250
{falsehoods}.
3251
3252
\target endif-command
3253
\section1 \\endif
3254
3255
The \\endif command and the corresponding \\if command
3256
enclose parts of a QDoc comment that will be included if
3257
the condition specified by the \l {if-command} {\\if} command's
3258
argument is true.
3259
3260
For more information, see the documentation of the \l {if-command}
3261
{\\if} command.
3262
3263
See also \l{if-command} {\\if}, \l{else-command} {\\else}, \l
3264
{defines-variable} {defines} and \l {falsehoods-variable}
3265
{falsehoods}.
3266
3267
\target else-command
3268
\section1 \\else
3269
3270
The \\else command specifies an alternative if the
3271
condition in the \l {if-command} {\\if} command is false.
3272
3273
The \\else command can only be used within \l {if-command}
3274
{\\if...\\endif} commands, but is useful when there is only two
3275
alternatives.
3276
3277
\target include-command
3278
\section1 \\include
3279
3280
The \\include command sends all or part of the file specified by
3281
its first argument to the QDoc input stream to be processed as a
3282
QDoc comment snippet.
3283
3284
The command is useful when some snippet of commands or text is to
3285
be used in multiple places in the documentation. Use the \\include
3286
command wherever you want to insert a snippet into the documentation.
3287
The file containing the snippet to include, must be located under the
3288
path(s) listed in the \l{sourcedirs-variable}{sourcedirs} or
3289
\l{exampledirs-variable}{exampledirs} QDoc configuration variable.
3290
It can be either any source file parsed by QDoc (or even the same one
3291
where \\include command is used), or any other text file. To store
3292
snippets in a separate file that is not meant to be parsed by QDoc,
3293
use a file extension that is not listed in
3294
\l{sources.fileextensions-variable}{sources.fileextensions};
3295
for example, \c .qdocinc.
3296
3297
The command can have one or more arguments. The first
3298
argument is always a file name. The contents of the file must be
3299
QDoc input, in other words, a sequence of QDoc commands and text, but
3300
without the enclosing QDoc comment \c{/}\c{*!} ... \c{*}\c{/} delimiters.
3301
If you want to include the entire named file, leave the second argument
3302
empty. If you want to include only part of the file, see the
3303
\l{2-argument-form}{two argument form} below. Here is an example
3304
of the one argument form:
3305
3306
\code [text] *
3307
/\1!
3308
\page corefeatures.html
3309
\title Core Features
3310
3311
\include examples/signalandslots.qdocinc
3312
\include examples/objectmodel.qdocinc
3313
\include examples/layoutmanagement.qdocinc
3314
\1/
3315
\endcode
3316
3317
3318
\target 2-argument-form
3319
\section2 \\include filename snippet-identifier
3320
3321
It is a waste of time to make a separate \c .qdocinc file for every
3322
QDoc include snippet you want to use in multiple places in the
3323
documentation, especially given that you probably have to put the
3324
copyright/license notice in every one of these files. If you
3325
have multiple snippets to be included, you can put them all in a
3326
single file and surround each one with:
3327
3328
\code [text]
3329
//! [snippet-id1]
3330
3331
QDoc commands and text...
3332
3333
//! [snippet-id1]
3334
3335
//! [snippet-id2]
3336
3337
More QDoc commands and text...
3338
3339
//! [snippet-id2]
3340
\endcode
3341
3342
Then you can use the two-argument form of the command:
3343
3344
\code [text]
3345
\include examples/signalandslots.qdocinc snippet-id2
3346
\include examples/objectmodel.qdocinc another-snippet-id
3347
\endcode
3348
3349
The sequence of QDoc commands and text found between the two tags
3350
with the same name as the second argument is sent to the QDoc input
3351
stream. You can even have nested snippets.
3352
3353
\note Snippet identifiers work also within documentation comment
3354
(\beginqdoc .. \endqdoc) blocks, so it's not necessary to use a
3355
separate \c .qdocinc file. When processing a comment block, QDoc
3356
removes any \c {//!} comment lines from the generated output.
3357
3358
\section2 Extra arguments
3359
3360
Since QDoc 6.3, any further arguments passed to the \\include command
3361
are used for injecting strings into the included content. To inject a
3362
string to a specific location in the content, add a backslash followed
3363
by a digit (1..9). The digits correspond with the order of the argument
3364
list. Enclose arguments in curly braces to ensure that QDoc renders the
3365
entire argument, including possible whitespace characters, as you expect.
3366
3367
\important Each additional argument (including the snippet ID) must be
3368
enclosed in braces. If you want to include the entire file,
3369
use an empty snippet ID: \c {{}}.
3370
3371
For example, given the following snippet in a file \c includes.qdocinc:
3372
3373
\code [text]
3374
//! [usage]
3375
To enable \e{\1}, select \uicontrol {\2} > \uicontrol Enable.
3376
//! [usage]
3377
\endcode
3378
3379
Then, the following \\include line:
3380
3381
\code [text]
3382
\include includes.qdocinc {usage} {detailed output} {Verbose}
3383
\endcode
3384
3385
Renders
3386
\quotation
3387
To enable \e {detailed output}, select \uicontrol {Verbose} >
3388
\uicontrol Enable.
3389
\endquotation
3390
3391
\target meta-command
3392
\section1 \\meta
3393
3394
The \\meta command is used for adding metadata to documentation.
3395
The command has two arguments: the first argument is the name of the
3396
metadata attribute, and the second argument is the value for the attribute.
3397
Each argument should be enclosed in curly brackets, as shown in this
3398
example:
3399
3400
\code [text] *
3401
/\1!
3402
\example demos/coffee
3403
\title Coffee Machine
3404
\brief A Qt Quick application with a state-based custom user interface.
3405
3406
\meta {tags} {quick,embedded,states,touch}
3407
\meta {category} {Application Examples}
3408
\1/
3409
\endcode
3410
3411
A number of metadata attributes have a specific purpose:
3412
3413
\b {Example Metadata}
3414
3415
Another use for \\meta command is to include metadata (tags) in
3416
\l {example-command}{\\example} documentation. By default, QDoc
3417
generates example tags based on the example's \l {title-command}{\\title}
3418
and module name. These tags are displayed in Qt Creator's Welcome mode,
3419
helping users navigate the list of examples.
3420
3421
Additional tags can be created with \c {\meta {tag} {tag1}}
3422
or \c {\meta {tags} {tag1,[tag2,...]}}.
3423
For example:
3424
3425
\code [text] *
3426
/\1!
3427
\example helloworld
3428
\title Hello World Example
3429
\meta {tags} {tutorial,basic}
3430
\1/
3431
\endcode
3432
3433
This would result in the following tags: \e {tutorial,basic,hello,world}.
3434
Common words such as \e example are ignored.
3435
3436
\b {Excluding Examples}
3437
3438
Marking an example \e broken will exclude it from the generated manifest
3439
file, effectively removing it from Qt Creator's Welcome mode.
3440
3441
\code [text]
3442
\meta {tag} {broken}
3443
\endcode
3444
3445
\b {Example Install Paths}
3446
3447
The \\meta command combined with an argument \c installpath specifies the
3448
location of an installed example. This value overrides the one that is set
3449
using the \c examplesinstallpath configuration variable.
3450
3451
\code [text] *
3452
/\1!
3453
\example helloworld
3454
\title Hello World Example
3455
\meta {installpath} {tutorials}
3456
\1/
3457
\endcode
3458
3459
See also \l {examplesinstallpath}.
3460
3461
\b {Status}
3462
3463
A \c status argument for the \\meta command adds a custom status description
3464
for a \l {class-command}{\\class} or a \l {qmltype-command}{\\qmltype}. This
3465
description will then appear in a table at the top of the type reference page.
3466
3467
\code [text] *
3468
/\1!
3469
\class QNativeInterface::QAndroidApplication
3470
\meta {status} {Android-specific}
3471
\1/
3472
\endcode
3473
3474
See also \l {Status}{status-related commands}.
3475
3476
\b {Document metadata}
3477
3478
A \c keywords argument for the \\meta command adds specified keywords
3479
as metadata for the generated document:
3480
3481
\code [text]
3482
\meta {keywords} {reference, internal}
3483
\endcode
3484
3485
In HTML output, these keywords are generated as a
3486
\c {<meta name="keywords" content="...">} element.
3487
3488
\target noautolist-command
3489
\section1 \\noautolist
3490
3491
The \\noautolist command indicates that the annotated list of C++
3492
classes or QML types, which is automatically generated at the
3493
bottom of the C++ or QML module page should be omitted, because
3494
the classes or types have been listed manually. This command can
3495
also be used with the \l {group-command}{\\group} command to omit
3496
the list of group members, when they are listed manually.
3497
3498
The command must stand on its own line. See \l {Qt Quick Controls QML Types}
3499
for an example. The page is generated from \c {qtquickcontrols2-qmlmodule.qdoc}.
3500
There you will find a QDoc comment containing the \c{\qmlmodule} command for
3501
the \l QtQuick.Controls module. The same comment contains a \c {\noautolist}
3502
command to disable automatic list generation, and a \l {generatelist-command}
3503
{\\generatelist} to list the QML types in a specific section of the document.
3504
3505
This command was introduced in QDoc 5.6.
3506
3507
Since Qt 5.10, this command can be applied also to \l{example-command}
3508
{\\example} documentation, where it causes the automatically generated
3509
list of files and images belonging to an example project to be omitted.
3510
3511
\target omit-command
3512
\section1 \\omit
3513
3514
The \\omit command and the corresponding \\endomit command
3515
delimit parts of the documentation that you want QDoc to skip. For
3516
example:
3517
3518
\code [text] *
3519
/\1!
3520
\table
3521
\row
3522
\li Basic Widgets
3523
\li Basic GUI widgets such as buttons, comboboxes
3524
and scrollbars.
3525
3526
\omit
3527
\row
3528
\li Component Model
3529
\li Interfaces and helper classes for the Qt
3530
Component Model.
3531
\endomit
3532
3533
\row
3534
\li Database Classes
3535
\li Database related classes, e.g. for SQL databases.
3536
\endtable
3537
\1/
3538
\endcode
3539
3540
\target raw-command
3541
\section1 \\raw (avoid!)
3542
3543
The \\raw command and the corresponding
3544
\\endraw command delimit a block of raw mark-up language code.
3545
3546
\warning Avoid using this command if possible. If you are trying to
3547
generate special table or list behavior, try to get the behavior you want
3548
using the \l {span-command} {\\span} and \l {div-command} {\\div}
3549
commands in your \l {table-command} {\\table} or \l {list-command}
3550
{\\list}.
3551
3552
The command takes an argument specifying the code's format.
3553
3554
QDoc generates the given code only when generating the format that
3555
was specified by the user.
3556
3557
For example, "\\raw HTML" will only generate code when QDoc
3558
generates HTML documentation.
3559
3560
\note You can often achieve the intended purpose by using QDoc commands,
3561
while reducing the chance of mistakes or content becoming unmaintained.
3562
3563
\target sincelist-command
3564
\section1 \\sincelist
3565
3566
The \\sincelist command expands to a detailed breakdown of new
3567
inclusions to the documented API in a specified version. Example
3568
usage:
3569
3570
\code [text] * \QtMajorVersion \QtMinorVersion \QtVer
3571
/\1!
3572
\page newclasses\2\3.html
3573
\title New Classes and Functions in \4
3574
\brief A comprehensive list of new classes and functions in \4.
3575
3576
\sincelist \4
3577
\1/
3578
\endcode
3579
3580
\\sincelist takes a single argument, a version string. The generated
3581
output includes all functionality that is marked with a
3582
\l {since-command}{\\since} command or a \l {since clause} matching
3583
the version string.
3584
3585
\target unicode-command
3586
\section1 \\unicode
3587
3588
The \\unicode command allows you to insert an arbitrary Unicode
3589
character in the document.
3590
3591
The command takes an argument specifying the character as an
3592
integer. By default, base 10 is assumed, unless a '0x' or '0'
3593
prefix is specified (for base 16 and 8, respectively).
3594
*/
qttools
src
qdoc
qdoc
doc
qdoc-manual-markupcmds.qdoc
Generated on
for Qt by
1.16.1