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