Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qdoc-manual-contextcmds.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page 14-qdoc-commands-contextcommands.html
6
\previouspage Topic Commands
7
\nextpage Document Navigation
8
9
\title Context Commands
10
11
The context commands provide information about the element being
12
documented that QDoc can't deduce on its own. For example:
13
\list
14
\li Is this class thread-safe?
15
\li Is this function reentrant?
16
\li Of which module is this class a member?
17
\li Which include statement is needed to use this class?
18
\endlist
19
20
Context commands can appear anywhere in a QDoc comment,
21
but they are normally placed near the top of the comment, just
22
below the \l {Topic Commands} {topic} command.
23
24
\list
25
\li \l {abstract-command} {\\abstract}
26
\li \l {attribution-command} {\\attribution}
27
\li \l {cmakecomponent-command} {\\cmakecomponent}
28
\li \l {cmakepackage-command} {\\cmakepackage}
29
\li \l {cmaketargetitem-command} {\\cmaketargetitem}
30
\li \l {compares-command}{\\compares} (Since QDoc 6.7)
31
\li \l {compareswith-command}{\\compareswith} (Since QDoc 6.7)
32
\li \l {default-command} {\\default}
33
\li \l {deprecated-command}{\\deprecated}
34
\li \l {ingroup-command}{\\ingroup}
35
\li \l {inheaderfile-command}{\\inheaderfile}
36
\li \l {inherits-command}{\\inherits}
37
\li \l {inmodule-command}{\\inmodule}
38
\li \l {internal-command}{\\internal}
39
\li \l {modulestate-command} {\\modulestate} (Since QDoc 6.5)
40
\li \l {nextpage-command}{\\nextpage}
41
\li \l {nonreentrant-command}{\\nonreentrant}
42
\li \l {overload-command}{\\overload}
43
\li \l {preliminary-command}{\\preliminary}
44
\li \l {previouspage-command}{\\previouspage}
45
\li \l {qmlabstract-command} {\\qmlabstract}
46
\li \l {qmldefault-command} {\\qmldefault}
47
\li \l {qmlenumeratorsfrom-command} {\\qmlenumeratorsfrom} (Since QDoc 6.8)
48
\li \l {qtcmakepackage-command} {\\qtcmakepackage}
49
\li \l {qtcmaketargetitem-command} {\\qtcmaketargetitem}
50
\li \l {readonly-command} {\\readonly}
51
\li \l {reentrant-command}{\\reentrant}
52
\li \l {reimp-command}{\\reimp}
53
\li \l {relates-command}{\\relates}
54
\li \l {required-command} {\\required}
55
\li \l {since-command}{\\since}
56
\li \l {startpage-command}{\\startpage}
57
\li \l {subtitle-command}{\\subtitle}
58
\li \l {threadsafe-command}{\\threadsafe}
59
\li \l {title-command}{\\title}
60
\li \l {toc-command}{\\toc} (Since QDoc 6.11)
61
\li \l {tocentry-command}{\\tocentry} (Since QDoc 6.11)
62
\li \l {wrapper-command}{\\wrapper}
63
\endlist
64
65
*/
66
67
/*!
68
\page 15-qdoc-commands-navigation.html
69
\previouspage Context Commands
70
\nextpage Status
71
72
\title Document Navigation
73
74
The navigation commands are for linking the pages of a document in
75
a meaningful sequence. Below is a sequence of QDoc comments that
76
shows a typical use of the navigation commands.
77
78
\section1 Example
79
\quotefile files/basicqt.qdoc.sample
80
81
The \l {startpage-command} {\\startpage} command creates a link to
82
the page the author wants as the first page of a multipage document.
83
84
The link is included in the generated HTML source code but has no
85
visual effect on the documentation:
86
87
\code
88
<head>
89
...
90
<link rel="start" href="basicqt.html" />
91
...
92
</head>
93
\endcode
94
95
\section1 Commands
96
97
\target previouspage-command
98
\section2 \\previouspage
99
100
The \\previouspage command links the current page to the previous
101
page in a sequence. The command has two arguments, each enclosed
102
by curly braces: the first is the link target (the title of
103
the previous page), the second is the link text. If the page's
104
title is equivalent to the link text, the second argument can be
105
omitted.
106
107
The command must stand alone on its own line.
108
109
\target nextpage-command
110
\section2 \\nextpage
111
112
The \\nextpage command links the current page to the next page in
113
a sequence. The command follows the same syntax and argument
114
convention as the \l {previouspage-command} {\\previouspage}
115
command.
116
117
\target startpage-command
118
\section2 \\startpage
119
120
The \\startpage command specifies the first page of a sequence of
121
pages. The command must stand alone on its own line, and its
122
unique argument is the title of the first document.
123
124
QDoc will generate a link to the start page and include it in the
125
generated HTML file, but this has no visual effect on the
126
documentation. The generated link type tells browsers and search
127
engines which document is considered by the author to be the
128
starting point of the collection.
129
130
\target toc-command
131
\section2 \\toc
132
133
The \\toc and \\endtoc commands specify a list of sub-topics
134
(pages) for the topic the command appears in. A table of contents
135
(TOC) hierarchy is generated for the entire documentation
136
project based on the TOC entries on each topic.
137
138
Within the \\toc .. \\endtoc block, use \qdoccmd {tocentry} commands
139
to specify the sub-topics by title. Like the \qdoccmd {l} (link)
140
command, \\tocentry takes an optional second argument for the
141
user-visible title in the generated TOC entry.
142
143
\badcode *
144
/\1!
145
\page index.html
146
\title Qt
147
...
148
\toc
149
\tocentry {Introduction to Qt} {Introduction}
150
\tocentry {What's new in Qt} {What's new}
151
\tocentry {Getting started}
152
\endtoc
153
\1/
154
\endcode
155
156
\\toc commands cannot be nested. However, each sub-topic can specify
157
their own TOC entries. A topic can use only one \\toc command.
158
159
QDoc writes the resulting table of contents structure in XML format
160
to a \e {<project>_toc.xml} file.
161
162
\note The root topic (index or landing page) must be specified in the project
163
configuration with either \c {navigation.landingpage} or \c
164
{navigation.homepage}. See \qdocvar navigation for more information.
165
166
The \\toc command was introduced to QDoc with Qt 6.11.
167
168
See also \qdoccmd {tocentry}.
169
170
\target tocentry-command
171
\section2 \\tocentry
172
173
Specifies a sub-topic (page) as an entry in table of contents. Can only be
174
used inside a pair of \\toc and \\endtoc commands.
175
176
The \\tocentry command was introduced to QDoc with Qt 6.11.
177
178
See also \qdoccmd {toc}.
179
*/
180
181
/*!
182
\page 16-qdoc-commands-status.html
183
\previouspage Document Navigation
184
\nextpage Thread Support
185
186
\title Status
187
188
These commands are for indicating that a documented element has
189
some special status. The element could be marked \e deprecated,
190
that is, it's about to be made obsolete and no longer included
191
in the public interface. The \l {since-command}{\\since} command
192
is for specifying the version number in which a function or class
193
first appeared. The \l {qmlabstract-command} {\\qmlabstract} command
194
is for marking a QML type as an abstract base class.
195
196
\target abstract-command
197
\target qmlabstract-command
198
\section1 \\abstract and \\qmlabstract
199
200
\\abstract is a synonym for the \\qmlabstract command. Add this
201
command to the \l {qmltype-command} {\\qmltype} comment for a QML
202
type when that type is meant to be used \e {only} as an abstract
203
base type. When a QML type is abstract, it means that the QML type
204
that can't be instantiated. Instead, the properties in its public
205
API are included in the public properties list on the reference
206
page for each QML type that inherits the abstract QML type. The
207
properties are documented as if they are properties of the
208
inheriting QML type.
209
210
Normally, when a QML type is marked with \e{\\qmlabstract}, it is
211
also marked with \e{\\internal} so that its reference page is not
212
generated. It the abstract QML type is not marked internal, it
213
will have a reference page in the documentation.
214
215
\target attribution-command
216
\section1 \\attribution
217
218
The \\attribution command marks a documented \qdoccmd page as license
219
attribution documentation.
220
221
The \l {annotatedattributions} {\\generatelist annotatedattributions}
222
command generates an annotated list of all license attribution pages
223
in the documentation project.
224
225
\target default-command
226
\section1 \\default
227
228
The \\default command is used for documenting a default value for
229
a QML property. The command takes a single argument, which is
230
displayed in the documentation as the default value.
231
232
\badcode *
233
/\1!
234
\qmlproperty real Item::x
235
\default 0.0
236
\1/
237
\endcode
238
239
If the default value is a non-empty string, use quotes:
240
241
\badcode *
242
/\1!
243
\qmlproperty string Item::state
244
\default "invalid"
245
\1/
246
\endcode
247
248
\target compares-command
249
\section2 \\compares
250
251
Use the \c {\compares} command to describe the comparison results for the
252
documented C++ type when compared to itself. You must use this command in
253
conjunction with the \l {class-command}{\\class} command.
254
255
\c {\compares} takes one of the following arguments:
256
257
//! [comparison-categories]
258
\list
259
\li \c strong
260
\li \c partial
261
\li \c weak
262
\li \c equality
263
\endlist
264
265
\c {strong}, \c {partial}, and \c {weak} relate to the ordering.
266
\c {equality} means that the type is only compared for equality.
267
//! [comparison-categories]
268
269
This command was introduced to QDoc with Qt 6.7.
270
271
See also \l {compareswith-command}{\\compareswith}.
272
273
\target compareswith-command
274
\section1 \\compareswith
275
276
Use the \c {\compareswith .. \endcompareswith} pair of commands to
277
describe the comparison results for the documented C++ type when
278
compared to other types. \c {\compareswith} takes two or more
279
arguments: a comparison category, followed by a type name, or a
280
space-separated list of type names. Any text lines between
281
\c {\compareswith} and \c {\endcompareswith} commands are
282
considered further details that apply to all types subject
283
to the comparison category argument.
284
285
Types that have one or more space in their name, such as
286
\c{unsigned long}, should be enclosed in braces.
287
288
For example:
289
290
\badcode *
291
/\1!
292
...
293
\compareswith strong int long {unsigned long} {unsigned int} char
294
...
295
\endcompareswith
296
...
297
\1/
298
\endcode
299
300
Argument enclosed in braces have their leading and trailing whitespaces
301
removed.
302
For example, \c{unsigned long} and \c{ unsigned long } are equivalent.
303
304
The comparison category argument must be one of the following:
305
\include qdoc-manual-contextcmds.qdoc comparison-categories
306
307
This command was introduced to QDoc with Qt 6.7.
308
309
See also \l {compares-command}{\\compares}.
310
311
\target qmldefault-command
312
\section1 \\qmldefault
313
314
The \\qmldefault command is for marking a QML property as the
315
\l {default-properties}
316
{default property}. The word \c default is displayed in
317
the documentation of the property.
318
319
\badcode *
320
/\1!
321
\qmlproperty list<Change> State::changes
322
This property holds the changes to apply for this state.
323
\qmldefault
324
325
By default, these changes are applied against the default state. If the state
326
extends another state, then the changes are applied against the state being
327
extended.
328
\1/
329
\endcode
330
331
See how QDoc renders this property on the reference page for the
332
\l {QtQuick.State.changes}{State} type.
333
334
\target qmlenumeratorsfrom-command
335
\section1 \\qmlenumeratorsfrom
336
337
Use the \\qmlenumeratorsfrom command in a \qdoccmd qmlproperty topic
338
with a property type \e enumeration, to automatically replicate the
339
documentation for enumerators from a C++ \qdoccmd enum topic.
340
341
The command takes a fully qualified C++ enum as an argument,
342
and generates a list of enumerators and their descriptions.
343
344
\note The C++ enum must be documented in the same project; QDoc
345
cannot access its documentation if it's part of an external
346
documentation set that the current project \qdocvar depends
347
on.
348
349
By default, each enumerator is prefixed with the type name the
350
property belongs to, with \c{.} as the separator.
351
352
For example:
353
354
\badcode *
355
/\1!
356
\qmlproperty enumeration QtMultimedia::Camera::error
357
\qmlenumeratorsfrom QCamera::Error
358
359
//! Outputs documentation for 'Camera.NoError', 'Camera.CameraError'
360
\1/
361
\endcode
362
363
If the enumerators are registered to QML under a different type
364
name, this name (prefix) can be specified using the optional
365
argument in square brackets:
366
367
\badcode
368
\qmlenumeratorsfrom [Errors] QCamera::Error
369
370
//! Outputs documentation for 'Errors.NoError', 'Errors.CameraError'
371
\1/
372
\endcode
373
374
This command was introduced in QDoc 6.8.
375
376
See also \qdoccmd {qmlproperty}, \qdoccmd {enum}, and \qdoccmd {value}.
377
378
\target dontdocument-command
379
\section1 \\dontdocument
380
381
The \\dontdocument command is only used in a dontdocument.qdoc file
382
for a particular module. This file specifies publically declared
383
classes or structs that are not meant to be documented. QDoc will
384
not print warnings about missing \\class comments for these classes
385
and structs.
386
387
Below you will find the \\dontdocument command in the
388
dontdocument.qdoc for widgets:
389
390
\badcode *
391
/\1!
392
\dontdocument (QTypeInfo QMetaTypeId)
393
\1/
394
\endcode
395
396
\target inheaderfile-command
397
\section1 \\inheaderfile
398
399
The \\inheaderfile meta-command is used for overriding the include statement
400
generated for a C++ class, namespace, or header file reference documentation.
401
402
By default, QDoc documents a \c {\class SomeClass} to be available with
403
a following include statement:
404
405
\code
406
#include <SomeClass>
407
\endcode
408
409
If the actual include statement differs from the default, this can be
410
documented as
411
412
\badcode
413
\class SomeClass
414
\inheaderfile Tools/SomeClass
415
...
416
\endcode
417
418
See also \l {class-command}{\\class} and
419
\l {headerfile-command}{\\headerfile}.
420
421
422
\target obsolete-command
423
\section1 \\obsolete
424
The \\obsolete command is superceded by the \\deprecated command.
425
426
This command is kept for backwards compatibility reasons only.
427
It may be removed in a future version of QDoc. Use the \\deprecated
428
command instead.
429
430
See also \l {deprecated-command}{\\deprecated}.
431
432
\target deprecated-command
433
\section1 \\deprecated
434
435
The \\deprecated command is for indicating that the associated element
436
is deprecated, and that it should no longer be used in new code.
437
438
The \\deprecated command takes two optional arguments:
439
\list
440
\li A version in square brackets (e.g. [6.2]).
441
\li A string with more information, for example a suggested
442
replacement.
443
\endlist
444
445
The version and the beginning of the reason must be on the same line
446
as the command. The reason can wrap onto subsequent lines and can
447
contain inline markup, such as links and emphasis. It ends at a blank
448
line, a command that starts another paragraph or block (such as
449
\c {\\note}), or a metadata command (such as \c {\\since}).
450
QDoc renders the reason with the deprecation notice, rather than in
451
the detailed description.
452
453
A bare or version-only command has no reason. Text starting on the
454
next line remains part of the detailed description. When a reason
455
is present, separate it from subsequent body text with a blank line;
456
a sentence-ending period does not end the reason.
457
458
When generating the reference documentation for a class, QDoc
459
creates and links to a separate page that documents deprecated members.
460
It's good practice to suggest an equivalent alternative.
461
462
\badcode *
463
/\1!
464
\fn MyClass::MyDeprecatedFunction
465
\deprecated [6.2] Use MyNewFunction() instead.
466
The replacement supports additional input formats.
467
468
The detailed description of this function starts here.
469
\1/
470
\endcode
471
472
These rules also apply to \l {obsolete-command}{\\obsolete}.
473
474
\target internal-command
475
\section1 \\internal
476
477
The \\internal command indicates that the documented element
478
is not part of the public interface.
479
480
The command must stand on its own line.
481
482
QDoc ignores the documentation as well as the documented item,
483
when generating the associated class reference documentation.
484
485
\badcode *
486
/\1!
487
\internal
488
489
Tries to find the decimal separator. If it can't find
490
it and the thousand delimiter is != '.' it will try to
491
find a '.';
492
\1/
493
int QDoubleSpinBoxPrivate::findDelimiter
494
(const QString &str, int index) const
495
{
496
int dotindex = str.indexOf(delimiter, index);
497
if (dotindex == -1 && thousand != dot && delimiter != dot)
498
dotindex = str.indexOf(dot, index);
499
return dotindex;
500
}
501
\endcode
502
503
This function will not be included in the documentation, unless QDoc
504
is called with the \c{-showinternal} command line option or the
505
\c{QDOC_SHOW_INTERNAL} environment variable is set.
506
507
\target modulestate-command
508
\section1 \\modulestate
509
510
Use the \\modulestate command within a \\module or \\qmlmodule
511
topic to provide a custom module state description.
512
513
The command takes an argument that describes the module's
514
state. For example:
515
516
\badcode *
517
/*!
518
\module QtFoo
519
\modulestate Experimental
520
\1/
521
\endcode
522
523
QDoc will then add this information on the module page:
524
525
\quotation
526
This module is in \e {Experimental} state.
527
\endquotation
528
529
\note Do not use this command to deprecate a module. Use the
530
\l {deprecated-command}{\\deprecated} command instead.
531
532
In HTML output, this state information appears also in the navigation
533
bar (breadcrumbs) of reference pages for the module's members.
534
535
See also \qdoccmd {preliminary}.
536
537
\target preliminary-command
538
\section1 \\preliminary
539
540
The \\preliminary command is for indicating that the documented
541
element is still under development.
542
543
The command must stand on its own line.
544
545
The \\preliminary command expands to a note in the
546
documentation, and marks the element as preliminary when it appears
547
in lists.
548
549
\badcode *
550
/\1!
551
\preliminary
552
553
Returns information about the joining type attributes of the
554
character (needed for certain languages such as Arabic or
555
Syriac).
556
557
\1/
558
QChar::JoiningType QChar::joiningType() const
559
{
560
return QChar::joiningType(ucs);
561
}
562
\endcode
563
564
Since QDoc version 6.12, it is possible to customize the status
565
descriptor and the contents of the generated note for elements
566
marked with \\preliminary.
567
568
See also \qdocvar {preliminary} configuration variable.
569
570
\target readonly-command
571
\section1 \\readonly
572
573
The \\readonly command is used in conjunction with a \l {qmlproperty-command}
574
{\\qmlproperty} command to mark the QML property as read-only.
575
576
\target required-command
577
\section1 \\required
578
579
The \\required command is used in conjunction with a \l {qmlproperty-command}
580
{\\qmlproperty} command to mark the QML property as required.
581
582
\b {See also} \l {The Property System}.
583
584
\target since-command
585
\section1 \\since
586
587
The \\since command tells in which minor release
588
the associated functionality was added.
589
590
If the argument passed to \\since contains no spaces, it is assumed to be
591
shorthand notation for the \l {productname-variable}{productname}, and QDoc
592
will prefix the version with the value of \c productname in the generated
593
output. If the \c productname variable is undefined, QDoc generates only
594
the version string.
595
596
The argument can also contain the product name explicitly:
597
598
\badcode
599
\since MyFramework 2.0
600
\endcode
601
602
In this case, the arguments (product and version) are used as is.
603
604
\section2 Inheritance of Since Information
605
606
Since QDoc version 6.5, C++ classes and QML types inherit the \\since statement
607
from their respective \l {module-command}{module} or \l {qmlmodule-command}
608
{QML module}, unless \\since is explicitly used in the type documentation.
609
610
\section2 Since Clause
611
612
The \\value command allows an optional \e {since} clause, enclosed in square
613
brackets, to immediately follow the command string. This is used for
614
marking specific C++ enum values with since information.
615
616
See also \l {value-command}{\\value} and \l {ignoresince}.
617
618
\target wrapper-command
619
\section1 \\wrapper
620
621
The \\wrapper command, when used in a C++ class documentation, marks the
622
class as a \e wrapper that provides access to a non-Qt API. This command
623
is used for suppressing warnings that might otherwise be generated for
624
members of such a class.
625
*/
626
627
628
/*!
629
\page 17-qdoc-commands-thread.html
630
\previouspage Status
631
\nextpage Relating Things
632
633
\title Thread Support
634
635
The thread support commands are for specifying the level of
636
support for multithreaded programming in a class or function.
637
There are three levels of support: \c threadsafe, \c reentrant and
638
\c nonreentrant.
639
640
The default is \c nonreentrant which means that the associated
641
class or function cannot be called by multiple threads. \c
642
Reentrant and \c threadsafe are levels primarily used for classes.
643
644
\c Reentrant means that all the functions in the referenced class
645
can be called simultaneously by multiple threads, provided that
646
each invocation of the functions reference unique data. While \c
647
threadsafe means that all the functions in the referenced class
648
can be called simultaneously by multiple threads even when each
649
invocation references shared data.
650
651
When a class is marked \l {reentrant-command} {\\reentrant} or \l
652
{threadsafe-command} {\\threadsafe}, functions in that class can
653
be marked \c nonreentrant using the \l {nonreentrant-command}
654
{\\nonreentrant} command.
655
656
\section1 Example
657
658
\target reentrant-example
659
\badcode *
660
/\1!
661
\class QLocale
662
\brief The QLocale class converts between numbers and their
663
string representations in various languages.
664
665
\reentrant
666
\ingroup i18n
667
\ingroup text
668
669
QLocale is initialized with a language/country pair in its
670
constructor and offers number-to-string and string-to-number
671
conversion functions similar to those in QString.
672
673
...
674
675
\nonreentrant
676
677
Sets the global default locale to \a locale. These values are
678
used when a QLocale object is constructed with no
679
arguments. If this function is not called, the system's locale
680
is used.
681
682
\warning In a multithreaded application, the default locale
683
should be set at application startup, before any non-GUI
684
threads are created.
685
686
\sa system(), c()
687
\1/
688
void QLocale::setDefault(const QLocale &locale)
689
{
690
default_d = locale.d;
691
}
692
\endcode
693
694
QDoc generates a notification when a class is
695
declared reentrant, and lists the exceptions (the declared
696
nonreentrant functions). A link to the general documentation on \l
697
{17-qdoc-commands-thread.html#reentrant} {reentrancy and thread-safety} is
698
included. In addition a warning, "\b Warning: This function is
699
not reentrant.", is generated in the nonreentrant functions'
700
documentation.
701
702
QDoc will generate the same notification and warnings when a class
703
is declared threadsafe.
704
705
For more information see the general documentation on \l
706
{17-qdoc-commands-thread.html#reentrant} {reentrancy and thread-safety}.
707
708
\section1 Commands
709
710
\target threadsafe-command
711
\section2 \\threadsafe
712
713
The \\threadsafe command includes a line in the documentation to
714
indicate that the associated class or function is \e threadsafe
715
and can be called simultaneously by multiple threads, even when
716
separate invocations reference shared data.
717
718
The command must stand on its own line.
719
720
The documentation generated from this command will be similar to
721
the what is generated for the \l {reentrant-command} {\\reentrant}
722
command. See the example above in the \l {reentrant-example}
723
{introduction}.
724
725
See also \l{reentrant-command} {\\reentrant} and
726
\l{nonreentrant-command} {\\nonreentrant}.
727
728
\target reentrant-command
729
\section2 \\reentrant
730
731
The \\reentrant command indicates that the associated class or
732
function can be called simultaneously by multiple threads,
733
provided that each invocation references its own data. See the \l
734
{reentrant-example} {example} above.
735
736
The command must stand on its own line.
737
738
See also \l{nonreentrant-command} {\\nonreentrant} and
739
\l{threadsafe-command} {\\threadsafe}.
740
741
\target nonreentrant-command
742
\section2 \\nonreentrant
743
744
The \\nonreentrant command indicates that the associated class or
745
function cannot be called by multiple threads. Nonreentrant is the
746
default case.
747
748
The command must stand on its own line.
749
750
When a class is marked \l {reentrant-command} {\\reentrant} or \l
751
{threadsafe-command} {\\threadsafe}, functions in that class can
752
be marked \c nonreentrant using this command in the \l{fn-command}
753
{\\fn} comment of the functions to be excluded.
754
755
See also \l{reentrant-command} {\\reentrant} and
756
\l{threadsafe-command} {\\threadsafe}.
757
*/
758
759
/*!
760
\page 18-qdoc-commands-relating.html
761
\previouspage Thread Support
762
\nextpage Grouping Things
763
764
\title Relating Things
765
766
The relating commands are for specifying how one documented
767
element relates to another documented element. Some examples:
768
\list
769
\li This function is an overload of another function.
770
\li This function is a reimplementation of another function.
771
\li This typedef is \e related to some class or header file.
772
\endlist
773
774
There is also a command for documenting that a QML type inherits
775
some other QML type.
776
777
\section1 Commands
778
779
\target inherits-command
780
\section2 \\inherits
781
782
The \\inherits command is for documenting that one QML type
783
inherits some other QML type. It must be included in the
784
inheriting element's \l{qmltype-command}{\\qmltype} comment.
785
The argument is the name of the inherited QML type,
786
optionally qualified with a QML module name.
787
788
\badcode *
789
/\1!
790
\qmltype PauseAnimation
791
\inqmlmodule QtQuick
792
\nativetype QDeclarativePauseAnimation
793
\ingroup qml-animation-transition
794
\since 4.7
795
\inherits Animation
796
\brief The PauseAnimation element provides a pause for an animation.
797
798
When used in a SequentialAnimation, PauseAnimation is a step
799
when nothing happens, for a specified duration.
800
801
A 500ms animation sequence, with a 100ms pause between two animations:
802
803
SequentialAnimation {
804
NumberAnimation { ... duration: 200 }
805
PauseAnimation { duration: 100 }
806
NumberAnimation { ... duration: 200 }
807
}
808
809
\sa {QML Animation and Transitions}, {declarative/animation/basics}{Animation basics example}
810
\1/
811
\endcode
812
813
QDoc includes this line on the reference page for the
814
\l [QML] PauseAnimation
815
element:
816
817
\quotation
818
Inherits \l [QML] Animation
819
\endquotation
820
821
When documenting a QML types directly in a .qml file, the \\inherits command
822
is normally not required as QDoc can detect the base type from QML syntax.
823
If present, an \\inherits command will override this automatic base type
824
detection.
825
826
\target overload-command
827
\section2 \\overload
828
829
Use the \e {\\overload} command to mark C++ function overloads. This command
830
must appear on its own line in the documentation comment.
831
832
\section3 How it works
833
834
When you have multiple C++ functions with the same name (overloads) that
835
perform similar work with different parameters, use \e {\\overload} to avoid
836
repetitive documentation. Functions without \e {\\overload} require complete
837
documentation. Functions with \e {\\overload} can focus on their specific
838
differences.
839
840
Functions marked with \e {\\overload} automatically suppress missing
841
parameter warnings, since they reference the documentation of the main
842
function.
843
844
\section3 Basic usage
845
846
\badcode *
847
/\1!
848
\overload
849
Brief description of what makes this overload different.
850
\1/
851
\endcode
852
853
\section3 Linking to the primary function
854
855
Add the function name to create a link to the primary function:
856
857
\badcode *
858
/\1!
859
\overload functionName()
860
Brief description of what makes this overload different.
861
\1/
862
\endcode
863
864
Use either qualified names (\c{ClassName::functionName()}) or unqualified
865
names (\c{functionName()}). QDoc automatically qualifies unqualified names
866
using the current class or namespace.
867
868
\note For historic reasons, a parameterless unqualified name like
869
\c {functionName()} serves as shorthand for linking to the primary overload,
870
not necessarily the parameterless overload. QDoc uses a search algorithm to
871
find the "best" overload to link to. To link to a specific parameterless
872
function, either designate it as the primary overload with
873
\c {\overload primary}, or use a fully qualified signature that explicitly
874
specifies the empty parameter list.
875
876
\section3 Designating a primary overload
877
878
By default, QDoc chooses the primary overload automatically. To explicitly
879
designate which overload serves as the primary, use:
880
881
\badcode *
882
/\1!
883
\overload primary
884
Main documentation for this function family.
885
Document all parameters here.
886
\1/
887
\endcode
888
889
Primary overloads:
890
\list
891
\li Contain the main function documentation.
892
\li Require complete parameter documentation.
893
\li Do not display "This function overloads..." text.
894
\li Serve as the link target for other overloads.
895
\endlist
896
897
Use \e {\\overload primary} when the most important overload differs from
898
QDoc's automatic selection, or when you need consistent linking behavior.
899
900
\target reimp-command
901
\section2 \\reimp
902
903
The \\reimp command is for indicating that a function is a
904
reimplementation of a virtual function without requiring any
905
additional documentation.
906
907
By default, QDoc will omit a reimplemented virtual function from the
908
class reference unless it is documented. This command ensures that an
909
otherwise undocumented function will be included.
910
911
The command must stand on its own line.
912
913
\badcode *
914
/\1!
915
\reimp
916
\1/
917
void QToolButton::nextCheckState()
918
{
919
Q_D(QToolButton);
920
if (!d->defaultAction)
921
QAbstractButton::nextCheckState();
922
else
923
d->defaultAction->trigger();
924
}
925
\endcode
926
927
This function will not be included in the documentation. Instead,
928
a link to the base function QAbstractButton::nextCheckState() will
929
appear in the documentation.
930
931
\target relates-command
932
\section2 \\relates
933
934
The \\relates command is for including the documentation of an
935
entity (a function, macro, typedef, enum, or variable) to a class,
936
namespace, or header file. The argument is the name of the class,
937
namespace, or header the entity is related to.
938
939
If the argument refers to a templated type, use the type name only
940
(without template parameters).
941
942
\badcode *
943
/\1!
944
\relates QChar
945
946
Reads a char from the stream \a in into char \a chr.
947
948
\sa {Format of the QDataStream operators}
949
\1/
950
QDataStream &operator>>(QDataStream &in, QChar &chr)
951
{
952
quint16 u;
953
in >> u;
954
chr.unicode() = ushort(u);
955
return in;
956
}
957
\endcode
958
959
The documentation for this function is included on the reference
960
page for class QChar, listed under the \e {Related Non-members} section.
961
962
Since QDoc 6.13, an entity can be related to multiple classes,
963
namespaces, or headers by using multiple \\relates commands. The
964
documentation is included on the reference page of the first
965
target. The reference pages of the other targets list the entity
966
under their \e {Related Non-members} section, with a link to its
967
documentation on the first target's page.
968
969
\code [text] *
970
/\1!
971
\relates Celsius
972
\relates Fahrenheit
973
974
Converts the temperature \a c to Fahrenheit.
975
\1/
976
Fahrenheit toFahrenheit(const Celsius &c)
977
\endcode
978
979
Here, the documentation for \c toFahrenheit() is included on the
980
reference page for \c Celsius, and the reference page for
981
\c Fahrenheit links to it.
982
983
The other targets can also be documented in a different module.
984
QDoc records the relationship in the index file of the module that
985
documents the entity. The reference page of the other target lists
986
the entity only if the module that documents the target loads that
987
index file, for example with the \qdocvar {depends} configuration
988
variable.
989
990
\note When QDoc resolves unqualified function or type names in
991
documentation, it searches the context of the page where the
992
documentation appears. Because \\relates moves the documentation
993
to a different class's page, autolinks that worked in the
994
original context may no longer resolve. Use fully qualified
995
names or explicit \\l commands for cross-references to members
996
of the original class.
997
*/
998
999
/*!
1000
\page 19-qdoc-commands-grouping.html
1001
\previouspage Relating Things
1002
\nextpage Naming Things
1003
1004
\title Grouping Things
1005
1006
The grouping commands relate classes to defined groups and
1007
modules. The groups are used when generating lists of related
1008
classes in the documentation, while the modules are elements of
1009
Qt's structure.
1010
1011
\section1 Commands
1012
1013
\target ingroup-command
1014
\section2 \\ingroup
1015
1016
The \\ingroup command indicates that the given
1017
class, page, or other entity belongs to a certain group of
1018
related documentation.
1019
1020
An entity may belong to multiple groups.
1021
1022
The \\ingroup command's argument is a group name, but note
1023
that the command considers the rest of the line as part of
1024
its argument. Make sure that the group name is followed by
1025
a linebreak.
1026
1027
\badcode *
1028
/\1!
1029
\class QDir
1030
\brief The QDir class provides access to directory
1031
structures and their contents.
1032
1033
\ingroup io
1034
...
1035
\1/
1036
\endcode
1037
1038
This adds the QDir class to the \c io group. An entry for QDir
1039
will then appear on the list created with, for example,
1040
the \l {annotatedlist-command} {\\annotatedlist} command with
1041
an argument \c io.
1042
1043
QDoc automatically generates links to associated groups on a
1044
C++ class, namespace, or header reference page. For example,
1045
given the above documentation for class \QDir and the following
1046
\l {group-command}{\\group} page:
1047
1048
\badcode *
1049
/\1
1050
\group io
1051
\title Input/Output and Networking
1052
...
1053
\1/
1054
\endcode
1055
1056
QDoc then outputs a statement on the QDir reference page:
1057
1058
\quotation
1059
\list
1060
\li \QDir is part of \l {Input/Output and Networking}.
1061
\endlist
1062
\endquotation
1063
1064
For HTML output, QDoc also generates a link to the group
1065
page as part of the navigation bar (breadcrumbs). If multiple
1066
\\ingroup commands are used, the first one that references
1067
a documented \\group is selected.
1068
1069
See also \l {group-command} {\\group}.
1070
1071
\target inmodule-command
1072
\section2 \\inmodule
1073
1074
The \\inmodule command relates a class to the module specified by
1075
the command's argument.
1076
1077
For the basic classes in Qt, a class's module is determined by its
1078
location, namely its directory. However, for extensions like
1079
ActiveQt and \QD, a class must be related to a module
1080
explicitly.
1081
1082
The command's argument is a module name, but note that the command
1083
considers the rest of the line as part of its argument. Make sure
1084
that the module name is followed by a linebreak.
1085
1086
\code
1087
/*!
1088
\class QDesignerTaskMenuExtension
1089
\inmodule QtDesigner
1090
* /
1091
\endcode
1092
1093
This ensures that the QDesignerTaskMenuExtension class is included
1094
in the \QD module, which means, for example, that the
1095
class will appear on the list created by calling the \l
1096
{generatelist-command} {\\generatelist} command with the \c
1097
{{classesbymodule QtDesigner}} argument.
1098
1099
See also \l {module-command} {\\module} and \l
1100
{generatelist-command} {\\generatelist}.
1101
*/
1102
1103
/*!
1104
\page 20-qdoc-commands-namingthings.html
1105
\previouspage Grouping Things
1106
\nextpage Markup Commands
1107
1108
\title Naming Things
1109
1110
In general, a title command considers everything that follows it
1111
until the first line break as its argument. If the title is so
1112
long it must span multiple lines, end each line (except the last
1113
one) with a backslash.
1114
1115
\section1 Commands
1116
1117
\target title-command
1118
\section2 \\title
1119
1120
The \\title command sets the title for a documentation page, or
1121
allows you to override it.
1122
1123
\badcode *
1124
/\1!
1125
\page signalandslots.html
1126
1127
\title Signals & Slots
1128
1129
Signals and slots are used for communication between
1130
objects. The signals and slots mechanism is a central
1131
feature of Qt, and probably the part that differs most
1132
from the features provided by other frameworks.
1133
1134
...
1135
\1/
1136
\endcode
1137
1138
See also \l {subtitle-command} {\\subtitle}.
1139
1140
\target subtitle-command
1141
\section2 \\subtitle
1142
1143
The \\subtitle command sets a subtitle for a documentation page.
1144
1145
\badcode *
1146
/\1!
1147
\page qtopiacore-overview.html
1148
1149
\title Qtopia Core
1150
\subtitle Qt for Embedded Linux
1151
1152
Qt/Embedded, the embedded Linux port of Qt, is a
1153
complete and self-contained C++ GUI and platform
1154
development tool for Linux-based embedded development.
1155
...
1156
\1/
1157
\endcode
1158
1159
See also \l {title-command} {\\title}.
1160
1161
*/
qttools
src
qdoc
qdoc
doc
qdoc-manual-contextcmds.qdoc
Generated on
for Qt by
1.18.0