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-topiccmds.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 13-qdoc-commands-topics.html
6 \previouspage Command Index
7 \nextpage Context Commands
8
9 \title Topic Commands
10
11 A topic command tells QDoc which source code element is being
12 documented. Some topic commands allow you to create documentation
13 pages that aren't tied to any underlying source code element.
14
15 When QDoc processes a QDoc comment, it tries to connect the
16 comment to an element in the source code by first looking for a
17 topic command that names the source code element. If there is no
18 topic command, QDoc tries to connect the comment to the source
19 code element that immediately follows the comment. If it can't do
20 either of these and if there is no topic command that indicates
21 the comment does not have an underlying source code element (e.g.
22 \l{page-command} {\\page}), then the comment is discarded.
23
24 \target topic argument
25
26 The name of the entity being documented is usually the only
27 argument for a topic command. Use the complete name. Sometimes
28 there can be a second parameter in the argument. See e.g. \l
29 {page-command} {\\page}.
30
31 \code
32 \enum QComboBox::InsertPolicy
33 \endcode
34
35 The \l {fn-command} {\\fn} command is a special case. For the \l
36 {fn-command} {\\fn} command, use the function's signature
37 including the class qualifier.
38
39 \code
40 \fn void QGraphicsWidget::setWindowFlags(Qt::WindowFlags wFlags)
41 \endcode
42
43 A topic command can appear anywhere in a comment but must stand
44 alone on its own line. It is good practice is to let the topic command
45 be the first line of the comment. If the argument spans several
46 lines, make sure that each line (except the last one) is ended
47 with a backslash. Moreover, QDoc counts parentheses, which means
48 that if it encounters a '(' it considers everything until the
49 closing ')' as its argument.
50
51 If a topic command is repeated with different arguments, the
52 same documentation will appear for both the units.
53
54 \badcode *
55 /\1!
56 \fn void PreviewWindow::setWindowFlags()
57 \fn void ControllerWindow::setWindowFlags()
58
59 Sets the widgets flags using the QWidget::setWindowFlags()
60 function.
61
62 Then runs through the available window flags, creating a text
63 that contains the names of the flags that matches the flags
64 parameter, displaying the text in the widgets text editor.
65 \1/
66 \endcode
67
68 The \c PreviewWindow::setWindowFlags() and \c
69 ControllerWindow::setWindowFlags() functions will get the same
70 documentation.
71
72 \section2 Nomenclature for files generated by topic commands
73
74 For many topic commands, such as \l {page-command}{\\page}, QDoc
75 generates a file when processing the documentation.
76
77 QDoc normalizes the name of each file before writing it to disk.
78 The following operations are performed:
79
80 \list
81 \li All sequences of non alphanumeric characters are replaced with a hyphen, '-'.
82 \li All uppercase letters are replaced with their lowercase equivalent.
83 \li All trailing hyphens are removed.
84 \endlist
85
86 For example, the following command generates a file named
87 \c{this-generates-a-file-and-writes-it-to-disk.html}:
88
89 \badcode
90 \page this_generates_a_file_(and_writes_it_to_DISK)-.html
91 \endcode
92
93 As the example shows, the name that is given to the file in the
94 command might differ from the name of the actual file that is
95 written to disk.
96
97 \section3 Prefixes and Suffixes for generated files
98
99 When QDoc generates a file, it may add a prefix, a suffix, or both,
100 depending on the element that the file will document.
101
102 The table below shows what those prefixes and suffixes are for
103 various elements.
104
105 \table
106 \header
107 \li Element
108 \li Prefix
109 \li Suffix
110 \li Command
111 \row
112 \li QML Modules
113 \li None
114 \li "-qmlmodule"
115 \li \l {qmlmodule-command}{\\qmlmodule}
116 \row
117 \li Modules
118 \li None
119 \li "-module"
120 \li \l {module-command}{\\module}
121 \row
122 \li Examples
123 \li The project name, as given by the \l
124 {project-variable}{project configuration variable},
125 followed by a hyphen.
126 \li "-example"
127 \li \l {example-command}{\\example}
128 \row
129 \li QML Types
130 \li The output prefix for QML, as given by the \l
131 {outputprefixes-variable}{outputprefixes configuration
132 variable}.
133
134 If the module that contains this type is known to QDoc,
135 the module name is added as a prefix, followed by the QML
136 output suffix, as defined by the \l
137 {outputsuffixes-variable}{outputsuffixes configuration
138 variable} and a hyphen.
139 \li None
140 \li \l {qmltype-command}{\\qmltype}
141 \endtable
142
143 \target class-command
144 \section1 \\class
145
146 The \\class command is for documenting a C++ \e class, a C/C++
147 \e struct, or a \e union. The argument is the complete, qualified
148 name of the class. The command tells QDoc that a class is part of
149 the public API, and lets you enter a detailed description.
150
151 \badcode *
152 /\1!
153 \class QMap::iterator
154 \inmodule QtCore
155
156 \brief The QMap::iterator class provides an STL-style
157 non-const iterator for QMap and QMultiMap.
158
159 QMap features both \l{STL-style iterators} and
160 \l{Java-style iterators}. The STL-style iterators ...
161 \1/
162 \endcode
163
164 The HTML documentation for the named class is written to a
165 \c{.html} file named from the class name, in lower case, and with
166 the double colon qualifiers replaced with '-'. For example, the
167 documentation for the \c QMap::iterator class is written to \c
168 qmap-iterator.html.
169
170 The file contains the class description from the \\class comment,
171 plus the documentation generated from QDoc comments for all the
172 class members: a list of the class's types, properties,
173 functions, signals, and slots.
174
175 In addition to the detailed description of the class, the \\class
176 comment typically contains an \l {inmodule-command} {\\inmodule}
177 command, as well as a \l {brief-command} {\\brief} description.
178 Here is a very simple example:
179
180 \badcode *
181 /\1!
182 \class PreviewWindow
183 \inmodule CustomWidgets
184 \brief The PreviewWindow class is a custom widget.
185 displaying the names of its currently set
186 window flags in a read-only text editor.
187
188 \ingroup miscellaneous
189
190 The PreviewWindow class inherits QWidget. The widget
191 displays the names of its window flags set with the \l
192 {function} {setWindowFlags()} function. It is also
193 provided with a QPushButton that closes the window.
194
195 ...
196
197 \sa QWidget
198 \1/
199 \endcode
200
201 The way QDoc renders this \\class depends on your \c {style.css}
202 file.
203
204 \target enum-command
205 \section1 \\enum
206
207 The \\enum command is for documenting a C++ enum type. The
208 argument is the full name of the enum type.
209
210 The enum values are documented in the \\enum comment using the \l
211 {value-command} {\\value} command. If an enum value is not
212 documented with \\value, QDoc emits a warning. These warnings can
213 be avoided using the \l {omitvalue-command} {\\omitvalue} command
214 to tell QDoc that an enum value should not be documented. The enum
215 documentation will be included on the class reference page, header
216 file page, or namespace page where the enum type is defined. For
217 example, consider the enum type \c {Corner} in the Qt namespace:
218
219 \code
220 enum Corner {
221 TopLeftCorner = 0x00000,
222 TopRightCorner = 0x00001,
223 BottomLeftCorner = 0x00002,
224 BottomRightCorner = 0x00003
225 #if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN)
226 ,TopLeft = TopLeftCorner,
227 TopRight = TopRightCorner,
228 BottomLeft = BottomLeftCorner,
229 BottomRight = BottomRightCorner
230 #endif
231 };
232 \endcode
233
234 This enum can be documented this way:
235
236 \badcode *
237 /\1!
238 \enum Qt::Corner
239
240 This enum type specifies a corner in a rectangle:
241
242 \value TopLeftCorner
243 The top-left corner of the rectangle.
244 \value TopRightCorner
245 The top-right corner of the rectangle.
246 \value BottomLeftCorner
247 The bottom-left corner of the rectangle.
248 \value BottomRightCorner
249 The bottom-right corner of the rectangle.
250
251 \omitvalue TopLeft
252 \omitvalue TopRight
253 \omitvalue BottomLeft
254 \omitvalue BottomRight
255 Bottom-right (omitted; not documented).
256 \1/
257 \endcode
258
259 Note the inclusion of the namespace qualifier.
260
261 See also \l {value-command} {\\value} and \l {omitvalue-command} {\\omitvalue}.
262
263 \target example-command
264 \section1 \\example
265
266 The \\example command is for documenting an example. The argument
267 is the example's path relative to one of the paths listed in the
268 \l {exampledirs-variable} {exampledirs} variable in the QDoc
269 configuration file.
270
271 The documentation page will be output to \c {modulename-path-to-example}.html.
272 QDoc will add a list of all the example's source and images files at the end
273 of the page, unless \l {noautolist-command}{\\noautolist} command is used or
274 the configuration variable \l {url.examples-variable}{url.examples} is defined
275 for the project.
276
277 For example, if \l {exampledirs-variable} {exampledirs} contains
278 \c $QTDIR/examples/widgets/imageviewer, then
279
280 \badcode *
281 /\1!
282 \example widgets/imageviewer
283 \title ImageViewer Example
284 \subtitle
285
286 The example shows how to combine QLabel and QScrollArea
287 to display an image.
288
289 ...
290 \1/
291 \endcode
292
293 \b {See also:} \l {noautolist-command}{\\noautolist},
294 \l {url.examples-variable}{url.examples},
295 \l {meta-command}{\\meta}
296
297 \target externalpage-command
298 \section1 \\externalpage
299
300 The \\externalpage command assigns a title to an external URL.
301
302 \badcode *
303 /\1!
304 \externalpage http://doc.qt.io/
305 \title Qt Documentation Site
306 \1/
307 \endcode
308
309 This allows you to include a link to the external page in your
310 documentation this way:
311
312 \badcode *
313 /\1!
314 At the \l {Qt Documentation Site} you can find the latest
315 documentation for Qt, Qt Creator, the Qt SDK and much more.
316 \1/
317 \endcode
318
319 To achieve the same result without using the \\externalpage
320 command, you would have to hard-code the address into your
321 documentation:
322
323 \badcode *
324 /\1!
325 At the \l {http://doc.qt.io/}{Qt Documentation Site}
326 you can find the latest documentation for Qt, Qt Creator, the Qt SDK
327 and much more.
328 \1/
329 \endcode
330
331 The \\externalpage command makes it easier to maintain the
332 documentation. If the address changes, you only need to change the
333 argument of the \\externalpage command.
334
335 \target fn-command
336 \section1 \\fn (function)
337
338 The \\fn command is for documenting a function. The argument is
339 the function's signature, including its template parameters (if
340 any), return type, const-ness, and list of formal arguments with
341 types. If the named function doesn't exist, QDoc emits a warning.
342
343 The command accepts \c auto as the type of a function, even though
344 the full type can be deduced by QDoc. In certain situations, it may
345 be preferable to use \e auto instead of the actual type of a
346 function. Using \c auto as the return type in the
347 \\fn-command lets the author to do this explicitly, also for types
348 that are defined without the \e auto keyword.
349
350 Since QDoc version 6.0, the \\fn command can be used for documenting
351 class members that are not explicitly declared in the header,
352 but are implicitly generated by the compiler; default constructor
353 and destructor, copy constructor and move-copy constructor,
354 assignment operator, and move-assignment operator.
355
356 When documenting a hidden friend, you can use either the
357 class-qualified syntax or the unqualified free function syntax.
358 For example, for:
359
360 \code
361 class Foo {
362 ...
363 friend bool operator==(const Foo&, const Foo&) { ... }
364 ...
365 }
366 \endcode
367
368 The command can be written as \c{"\fn Foo::operator==(const
369 Foo&, const Foo&)"} or as the free function \c{"\fn bool
370 operator==(const Foo&, const Foo&)"}. QDoc resolves hidden
371 friends by searching classes referenced in the function's
372 parameter types.
373
374 \note The \\fn command is QDoc's default command: when no
375 topic command can be found in a QDoc comment, QDoc tries to tie
376 the documentation to the following code as if it is the
377 documentation for a function. Hence, it is normally not necessary
378 to include this command when documenting a function, if the
379 function's QDoc comment is written immediately above the function
380 implementation in the \c .cpp file. But it must be present when
381 documenting an inline function in the \c .cpp file that is
382 implemented in the \c .h file.
383
384 \badcode *
385 /\1!
386 \fn bool QToolBar::isAreaAllowed(Qt::ToolBarArea area) const
387
388 Returns \c true if this toolbar is dockable in the given
389 \a area; otherwise returns \c false.
390 \1/
391 \endcode
392
393 \note Running in debug mode (pass the \c {-debug} command line option
394 or set the \c QDOC_DEBUG environment variable before invoking QDoc)
395 can help troubleshoot \\fn commands that QDoc fails to parse. In
396 debug mode, additional diagnostic information is available.
397
398 See also \l {overload-command} {\\overload}.
399
400 \target group-command
401 \section1 \\group
402
403 The \\group command creates a separate page that lists the classes,
404 pages, or other entities belonging to a named group. The argument
405 is the group name.
406
407 A class is included in a group by using the \l {ingroup-command}
408 {\\ingroup} command. Overview pages can also be related to a group
409 using the same command, but the list of overview pages must be
410 requested explicitly using the \l {generatelist-command}
411 {\\generatelist} command (see example below).
412
413 The \\group command is typically followed by a \l {title-command}
414 {\\title} command and a short introduction to the group. The
415 HTML page for the group is written to an \c {.html} file named
416 <lower-case-group-name>.html.
417
418 Each entity in the group is listed as a link (using page title
419 or class name), followed by a decription from the \l {brief-command}
420 {\\brief} command in the entity's documentation.
421
422 \badcode *
423 /\1!
424 \group io
425 \title Input/Output and Networking
426 \1/
427 \endcode
428
429 QDoc generates a group page \c{io.html}.
430
431 Note that overview pages related to the group must be listed
432 explicitly using the \l {generatelist-command} {\\generatelist}
433 command with the \c related argument.
434
435 \badcode *
436 /\1!
437 \group architecture
438
439 \title Architecture
440
441 These documents describe aspects of Qt's architecture
442 and design, including overviews of core Qt features and
443 technologies.
444
445 \generatelist{related}
446 \1/
447 \endcode
448
449 See also \l {ingroup-command} {\\ingroup}, \l {annotatedlist-command}
450 {\\annotatedlist}, \l {generatelist-command} {\\generatelist}, and
451 \l {noautolist-command}{\\noautolist}.
452
453 \target headerfile-command
454 \section1 \\headerfile
455
456 The \\headerfile command is for documenting the global functions,
457 types and macros that are declared in a header file, but not in a
458 namespace. The argument is the name of the header file. The HTML
459 page is written to a \c {.html} file constructed from the header
460 file argument.
461
462 The documentation for a function, type, or macro that is declared
463 in the header file being documented, is included in the header file
464 page using the \l {relates-command} {\\relates} command.
465
466 If the argument doesn't exist as a header file, the \\headerfile
467 command creates a documentation page for the header file anyway.
468
469 \badcode *
470 /\1!
471 \headerfile <QtAlgorithms>
472
473 \title Generic Algorithms
474
475 \brief The <QtAlgorithms> header file provides
476 generic template-based algorithms.
477
478 Qt provides a number of global template functions in \c
479 <QtAlgorithms> that work on containers and perform
480 well-know algorithms.
481 \1/
482 \endcode
483
484 QDoc generates a header file page, \c{qtalgorithms.html}.
485
486 See also \l {inheaderfile-command}{\\inheaderfile}.
487
488 \target macro-command
489 \section1 \\macro
490
491 The \\macro command is for documenting a C++ macro. The argument
492 is the macro in one of three styles: function-like macros like
493 Q_ASSERT(), declaration-style macros like Q_PROPERTY(), and macros
494 without parentheses like Q_OBJECT.
495
496 The \\macro comment must contain a \l {relates-command}
497 {\\relates} command that attaches the macro comment to a class,
498 header file, or namespace. Otherwise, the documentation will be
499 lost.
500
501 \target module-command
502 \section1 \\module
503
504 The \\module creates a page that lists the classes belonging to
505 the module specified by the command's argument. A class included
506 in the module by including the \l {inmodule-command} {\\inmodule}
507 command in the \\class comment.
508
509 The \\module command is typically followed by a \l {title-command}
510 {\\title} and a \l {brief-command} {\\brief} command. Each class
511 is listed as a link to the class reference page followed by the
512 text from the class's \l {brief-command} {\\brief} command. For
513 example:
514
515 \badcode *
516 /\1!
517 \module QtNetwork
518
519 \title Qt Network Module
520
521 \brief Contains classes for writing TCP/IP clients and servers.
522
523 The network module provides classes to make network
524 programming easier and portable. It offers both
525 high-level classes such as QNetworkAccessManager that
526 implements application-level protocols, and
527 lower-level classes such as QTcpSocket, QTcpServer, and
528 QUdpSocket.
529 \1/
530 \endcode
531
532 The \l {noautolist-command} {\\noautolist} command can be used here
533 to omit the automatically generated list of classes at the end.
534
535 See also \l {inmodule-command} {\\inmodule}
536
537 \target namespace-command
538 \section1 \\namespace
539
540 The \\namespace command is for documenting the contents of the C++
541 namespace named as its argument. The reference page QDoc generates
542 for a namespace is similar to the reference page it generates for a
543 C++ class.
544
545 \badcode *
546 /\1!
547 \namespace Qt
548
549 \brief Contains miscellaneous identifiers used throughout the Qt library.
550 \1/
551 \endcode
552
553 Note that in C++, a particular namespace can be used in more
554 than one module, but when C++ elements from different modules
555 are declared in the same namespace, the namespace itself must
556 be documented in one module only. For example, namespace Qt in
557 the example above contains types and functions from both QtCore
558 and QtGui, but it is documented with the \\namespace command
559 only in QtCore.
560
561 \target page-command
562 \section1 \\page
563
564 The \\page command is for creating a stand-alone documentation
565 page.
566
567 The \\page command expects a single argument that represents the
568 name of the file where QDoc should store the page.
569
570 The page title is set using the \l {title-command} {\\title}
571 command.
572
573 \badcode *
574 /\1!
575 \page aboutqt.html
576
577 \title About Qt
578
579 Qt is a C++ toolkit for cross-platform GUI
580 application development. Qt provides single-source
581 portability across Microsoft Windows, macOS, Linux,
582 and all major commercial Unix variants.
583
584 Qt provides application developers with all the
585 functionality needed to build applications with
586 state-of-the-art graphical user interfaces. Qt is fully
587 object-oriented, easily extensible, and allows true
588 component programming.
589
590 ...
591 \1/
592 \endcode
593
594 QDoc renders this page in \c {aboutqt.html}.
595
596 \target property-command
597 \section1 \\property
598
599 The \\property command is for documenting a Qt property. The
600 argument is the full property name.
601
602 A property is defined using the Q_PROPERTY() macro. The macro
603 takes as arguments the property's name and its set, reset and get
604 functions.
605
606 \badcode
607 Q_PROPERTY(QString state READ state WRITE setState)
608 \endcode
609
610 The set, reset and get functions don't need to be documented,
611 documenting the property is sufficient. QDoc will generate a list
612 of the access function that will appear in the property
613 documentation which in turn will be located in the documentation
614 of the class that defines the property.
615
616 The \\property command comment typically includes a \l
617 {brief-command} {\\brief} command. For properties the \l
618 {brief-command} {\\brief} command's argument is a sentence
619 fragment that will be included in a one line description of the
620 property. The command follows the same rules for the
621 description as the \l {variable-command} {\\variable} command.
622
623 \badcode *
624 /\1!
625 \property QPushButton::flat
626 \brief Whether the border is disabled.
627
628 This property's default is false.
629 \1/
630 \endcode
631
632 \target qmlattachedproperty-command
633 \section1 \\qmlattachedproperty
634
635 The \\qmlattachedproperty command is for documenting a QML
636 property that will be attached to some QML type. See
637 \l{Attached Properties and Attached Signal Handlers}
638 {Attached Properties}. The argument is the rest of the line.
639 It must start with the property type, followed by the QML
640 type name where the property is declared, the \c{::}
641 qualifier, and finally the property name.
642
643 For example, to document a boolean QML attached property named
644 \c isCurrentItem for the \c ListView type:
645
646 \badcode *
647 /\1!
648 \qmlattachedproperty bool ListView::isCurrentItem
649
650 This attached property is \c true if this delegate is the current
651 item; otherwise false.
652
653 It is attached to each instance of the delegate.
654
655 This property may be used to adjust the appearance of the current
656 item, for example:
657
658 \snippet doc/src/snippets/declarative/listview/listview.qml isCurrentItem
659 \1/
660 \endcode
661
662 QDoc includes this attached property on the QML reference page for the
663 \l [QML] {ListView} type.
664
665 \note Like \l{qmlproperty-command}{\\qmlproperty}, \\qmlattachedproperty
666 accepts a QML module identifier as part of its argument.
667
668 \target qmlattachedsignal-command
669 \section1 \\qmlattachedsignal
670
671 The \\qmlattachedsignal command is for documenting an attachable
672 \l{Signal and Handler Event System}{signal}. The \\qmlattachedsignal
673 command is used just like the \l{qmlsignal-command} {\\qmlsignal} command.
674
675 The argument is the rest of the line. It should be the name of the
676 QML type where the signal is declared, the \c{::}
677 qualifier, and finally the signal name. For example, a QML
678 attached signal named \c add() in the \c GridView
679 element is documented like this:
680
681 \badcode *
682 /\1!
683 \qmlattachedsignal GridView::add()
684 This attached signal is emitted immediately after an item is added to the view.
685 \1/
686 \endcode
687
688 QDoc includes this documentation on the QML reference page for the
689 \l GridView element.
690
691 \note Like \l{qmlproperty-command}{\\qmlproperty}, \\qmlattachedsignal accepts
692 a QML module identifier as part of its argument.
693
694 \target qmlvaluetype-command
695 \section1 \\qmlvaluetype
696
697 The \\qmlvaluetype command is for documenting a \l [QtQml]
698 {QML Value Types}{value type} for QML. The command takes
699 a type name as its only argument.
700
701 \\qmlvaluetype is functionally identical to the
702 \l {qmltype-command}{\\qmltype} command. The only difference
703 is that the type will be titled (and grouped) as a
704 \e {QML value type}.
705
706 \target qmlclass-command
707 \section1 \\qmlclass
708
709 This command is deprecated. Use \l{qmltype-command} {\\qmltype}
710 instead.
711
712 \target qmlenum-command
713 \section1 \\qmlenum
714
715 The \\qmlenum command is for documenting a QML enumeration. The command
716 takes a single argument: the full name of the enumeration type, including
717 the parent QML type and, optionally, the QML module.
718
719 The enumerators and their descriptions are documented using
720 \qdoccmd {value} commands.
721
722 For example,
723
724 \badcode *
725 /\1!
726 \qmlenum My.Module::Color::Channel
727 \brief Specifies a color channel in the RGB colorspace.
728
729 \value R
730 Red color channel
731
732 \value G
733 Green color channel
734
735 \value B
736 Blue color channel
737 \1/
738 \endcode
739
740 This generates documentation for an enumeration \e Channel, with three
741 enumerators: \e {Color.R}, \e {Color.G}, and \e {Color.B}. By default,
742 the parent QML type name is used as a prefix for the enumerators.
743
744 If the first argument to the qdoccmd{value} command already includes a
745 prefix, it is used as is:
746
747 \badcode
748 \value Channel.R
749 Red color channel
750 \value Channel.G
751 Green color channel
752 \value Channel.B
753 Blue color channel
754 \endcode
755
756 Here, the enumerators are listed as \e {Channel.R}, \e {Channel.G}, and
757 \e {Channel.B}.
758
759 Alternatively, it's possible to replicate the enumerators' documentation
760 from an existing C++ \qdoccmd {enum} topic, by using the
761 \qdoccmd {qmlenumeratorsfrom} command.
762
763 This command was introduced with Qt 6.10.
764
765 See also \qdoccmd {qmlenumeratorsfrom}.
766
767 \target qmlmethod-command
768 \section1 \\qmlmethod
769
770 The \\qmlmethod command is for documenting a QML method. The
771 argument is the complete method signature, and must include
772 a return type and parameter names and types enclosed in
773 parentheses. If a method takes no arguments, use \c{()}.
774
775 \badcode *
776 /\1!
777 \qmlmethod void TextInput::select(int start, int end)
778
779 Causes the text from \a start to \a end to be selected.
780
781 If either start or end is out of range, the selection is not changed.
782
783 After having called this, selectionStart will become the lesser, and
784 selectionEnd the greater (regardless of the order passed to this method).
785
786 \sa selectionStart, selectionEnd
787 \1/
788 \endcode
789
790 QDoc includes this documentation on the type reference page for the
791 \l{QtQuick::TextInput::select()}{TextInput} type.
792
793 \target qmltype-command
794 \section1 \\qmltype
795
796 The \\qmltype command is for documenting a QML type. The command
797 has one argument, which is the name of the QML type.
798
799 If the QML type has an equivalent C++ class, you can specify that class
800 with the \qdoccmd nativetype context command.
801
802 The \l {inqmlmodule-command}{\\inqmlmodule} command documents the
803 QML module the type belongs to. The argument passed to this command
804 must match with a documented \l {qmlmodule-command}{\\qmlmodule}
805 page.
806
807 \badcode *
808 /\1!
809 \qmltype Transform
810 \nativetype QGraphicsTransform
811 \inqmlmodule QtQuick
812
813 \brief Provides a way to build advanced transformations on Items.
814
815 The Transform element is a base type which cannot be
816 instantiated directly.
817 \1/
818 \endcode
819
820 Here, the \e{\\qmltype} comment includes \qdoccmd nativetype
821 to specify that a Transform is the QML counterpart to the
822 C++ class QGraphicsTransform. A \\qmltype comment should
823 always include a \l {since-command} {\\since} command, because all
824 QML types are new. It should also include a \l{brief-command}
825 {\\brief} description. If a QML type is a member of a QML type group,
826 the \\qmltype comment should include one or more \l{ingroup-command}
827 {\\ingroup} commands.
828
829 \note QDoc automatically detects QML singleton types and uncreatable types
830 when the corresponding C++ class uses either the \c{QML_SINGLETON} or
831 \c{QML_UNCREATABLE} macro. For such types, using \qdoccmd {qmltype} is
832 sufficient, as the singleton/uncreatable nature will be detected and
833 documented automatically.
834
835 \target qmlsingletontype-command
836 \section1 \\qmlsingletontype
837
838 The \\qmlsingletontype command is for explicitly documenting a QML singleton type.
839 This command is functionally identical to \l{qmltype-command}{\\qmltype}, but it
840 explicitly marks the type as a singleton regardless of the C++ implementation.
841
842 A QML singleton type ensures only one instance exists in the QML engine.
843 The singleton designation is displayed in the generated documentation with
844 a "(Singleton)" indicator in the title and an explanatory note.
845
846 \badcode *
847 /\1!
848 \qmlsingletontype Settings
849 \inqmlmodule MyApp
850
851 \brief Provides application-wide settings as a singleton.
852
853 The Settings type is a singleton that maintains application
854 configuration. Access it directly without instantiation.
855 \1/
856 \endcode
857
858 For C++ classes that use the \c{QML_SINGLETON} macro, prefer using
859 \qdoccmd {qmltype} instead, as QDoc will automatically detect the singleton
860 nature from the C++ code.
861
862 See also \qdoccmd {qmluncreatabletype}.
863
864 \target qmluncreatabletype-command
865 \section1 \\qmluncreatabletype
866
867 The \\qmluncreatabletype command is for explicitly documenting a type that
868 is registered to the QML type system but cannot be instantiated directly in QML.
869
870 This command is functionally identical to \qdoccmd {qmltype}, but it
871 explicitly marks the type as uncreatable regardless of the C++ implementation.
872
873 The uncreatable designation is displayed in the generated documentation with
874 an "(Uncreatable)" indicator in the title and an explanatory note.
875
876 \code [text] *
877 /\1!
878 \qmluncreatabletype Dialog
879 \inqmlmodule QtQuick.Dialogs
880
881 \brief The base type of native dialogs.
882 \1/
883 \endcode
884
885 For C++ classes that use the \c{QML_UNCREATABLE} macro, prefer using
886 \qdoccmd {qmltype} instead, as QDoc will automatically detect the uncreatable
887 nature from the C++ code.
888
889 The \\qmluncreatabletype command was introduced to QDoc in Qt 6.12.
890
891 See also \qdoccmd {qmlsingletontype}.
892
893 \target qmlproperty-command
894 \section1 \\qmlproperty
895
896 The \\qmlproperty command is for documenting a QML property. The
897 argument is the rest of the line. The argument text should be the
898 property type, followed by the QML type name, the \c{::}
899 qualifier, and finally the property name. If we have a QML
900 property named \c x in QML type \c Translate, and the property
901 has type \c {real}, the \\qmlproperty for it would look like this:
902
903 \badcode *
904 /\1!
905 \qmlproperty real Translate::x
906
907 The translation along the X axis.
908 \1/
909 \endcode
910
911 QDoc includes this QML property on the QML reference page for the
912 \l [QML] {Translate} type.
913
914 The \l{default-command}{\\default} command is used to document the
915 default value of a property:
916
917 \badcode
918 \qmlproperty real AxisHelper::gridOpacity
919 \default 0.5
920 \endcode
921
922 If the QML property exposes a C++ enum, the QML property is defined
923 with type \c{enumeration}:
924
925 \badcode
926 \qmlproperty enumeration ParticleShape3D::ShapeType
927 \endcode
928
929 Properties with enumeration type and those that hold a bit-wise
930 combination of flags can use the \l{value-command}{\\value} command
931 to document the acceptable values.
932
933 \badcode
934 \qmlproperty enumeration Buffer::textureFilterOperation
935 Specifies the texture filtering mode...
936 \value Buffer.Nearest Use nearest-neighbor filtering.
937 \endcode
938
939 QDoc also accepts a fully qualified property name, including the
940 QML module identifier:
941
942 \badcode
943 \qmlproperty bool QtQuick.Controls::Button::highlighted
944 \endcode
945
946 If specified, the module identifier (above, \c {QtQuick.Controls})
947 must match with the value passed to the \l {inqmlmodule-command}{\\inqmlmodule}
948 command in the associated \\qmltype documentation. If the name of
949 the QML type the property belongs to is unique across all types in
950 the documentation project, the module identifier can be omitted.
951
952 \target qmlsignal-command
953 \section1 \\qmlsignal
954
955 The \\qmlsignal command is for documenting a QML signal.
956 The argument is the rest of the line. The arguments should be: the QML type
957 where the signal is declared, the \c{::} qualifier, and finally the signal
958 name. If we have a QML signal named \c clicked(), the documentation for it
959 would look like this:
960
961 \badcode *
962 /\1!
963 \qmlsignal MouseArea::clicked(MouseEvent mouse)
964
965 This signal is emitted when there is a click. A click is defined as a
966 press followed by a release, both inside the MouseArea.
967 \1/
968 \endcode
969
970 QDoc includes this documentation on the QML reference page for the
971 \l [QML] {MouseArea} type.
972
973 \note Like \l{qmlproperty-command}{\\qmlproperty}, \\qmlsignal
974 accepts a QML module identifier as part of its argument.
975
976 \target qmlmodule-command
977 \section1 \\qmlmodule
978
979 Use the \c{\qmlmodule} command to create a \c QML module page. A QML
980 module page is a collection of QML types or any related material. The
981 command takes an optional \c <VERSION> number argument, and is similar
982 to the \l{group-command}.
983
984 A QML type is associated with a module by adding the
985 \l{inqmlmodule-command}{\\inqmlmodule} command to the comment-block that
986 documents the type. You can link to any member of a QML module using the
987 module name and two colons (\c{::}) prefix.
988
989 \badcode *
990 /\1!
991 A link to the TabWidget of the UI Component is \l {UIComponent::TabWidget}.
992 \1/
993 \endcode
994
995 QDoc generates a page for the module that lists all the members of the
996 module.
997
998 \badcode *
999 /\1!
1000 \qmlmodule ClickableComponents
1001
1002 This is a list of the Clickable Components set. A Clickable component
1003 responds to a \c clicked() event.
1004 \1/
1005 \endcode
1006
1007 \target inqmlmodule-command
1008 \section1 \\inqmlmodule
1009
1010 A QML type is marked as being available under a specific QML module
1011 import by inserting the \\inqmlmodule command in a
1012 \l {qmltype-command}{\\qmltype} topic. The command takes the module
1013 (import) name, without a version number, as the only argument.
1014
1015 The QML module name must match with a QML module documented with
1016 the (\l{qmlmodule-command}{\\qmlmodule} command).
1017
1018 \badcode *
1019 /\1!
1020 \qmltype ClickableButton
1021 \inqmlmodule ClickableComponents
1022
1023 A clickable button that responds to the \c click() event.
1024 \1/
1025 \endcode
1026
1027 QDoc outputs a row \e {Import statement: import <qmlmodule>}
1028 in a table at the top of the QML type reference page.
1029
1030 When linking to QML types, the QML module identifier may appear in
1031 the link target. For example:
1032
1033 \badcode
1034 \l {ClickableComponents::}{ClickableButton}
1035 \endcode
1036
1037 Links to the type reference page, with \e ClickableButton as the
1038 link text.
1039
1040 \target instantiates-command
1041 \section1 \\instantiates
1042
1043 The \\instantiates command is deprecated since Qt 6.8.
1044 Use \qdoccmd nativetype instead.
1045
1046
1047 \target nativetype-command
1048 \section1 \\nativetype
1049
1050 The \\nativetype-command must be used in conjunction with the
1051 \qdoccmd qmltype topic command. The command takes a C++ class as its
1052 argument. If QDoc cannot find the C++ class, it issues a warning. This
1053 command was introduced with Qt 6.8.
1054
1055 Use the \\nativetype-command to specify what the type is called in C++.
1056 This ensures that the requisites block generated in the documentation for
1057 the QML type contains an "In C++" entry. The C++ class will have a
1058 corresponding "In QML" entry.
1059
1060 Any one QML type can only have one native type. QDoc issues a warning if
1061 redefinition occurs. However, multiple QML types can have the same C++
1062 class as their native type. The C++ class documentation will contain a list
1063 of all corresponding types in QML.
1064
1065 \badcode *
1066 /\1!
1067 \qmltype Transform
1068 \nativetype QGraphicsTransform
1069 \inqmlmodule QtQuick
1070
1071 \brief Provides a way to build advanced transformations on Items.
1072
1073 The Transform element is a base type which cannot be
1074 instantiated directly.
1075 \1/
1076 \endcode
1077
1078 Here, the \e{\\qmltype} topic includes \e{\\nativetype} to specify that a
1079 Transform is called QGraphicsTransform in C++.
1080
1081
1082 \target typealias-command
1083 \section1 \\typealias
1084
1085 The \\typealias command is similar to \l {typedef-command}{\\typedef},
1086 but specific to documenting a C++ type alias:
1087
1088 \code
1089 class Foo
1090 {
1091 public:
1092 using ptr = void*;
1093 // ...
1094 }
1095 \endcode
1096
1097 This can be documented as
1098
1099 \badcode *
1100 /\1!
1101 \typealias Foo::ptr
1102 \1/
1103 \endcode
1104
1105 The \\typealias command was introduced in QDoc 5.15.
1106
1107 See also \l {typedef-command}{\\typedef}.
1108
1109 \target typedef-command
1110 \section1 \\typedef
1111
1112 The \\typedef command is for documenting a C++ typedef. The
1113 argument is the name of the typedef. The documentation for
1114 the typedef will be included in the reference documentation
1115 for the class, namespace, or header file in which the typedef
1116 is declared. To relate the \\typedef to a class, namespace, or
1117 header file, the \\typedef comment must contain a
1118 \l {relates-command} {\\relates} command.
1119
1120 \badcode *
1121 /\1!
1122 \typedef QObjectList
1123 \relates QObject
1124
1125 Synonym for QList<QObject>.
1126 \1/
1127 \endcode
1128
1129 Other typedefs are located on the reference page for the class
1130 that defines them.
1131
1132 \badcode *
1133 /\1!
1134 \typedef QList::Iterator
1135
1136 Qt-style synonym for QList::iterator.
1137 \1/
1138 \endcode
1139
1140 See also \l {typealias-command}{\\typealias}.
1141
1142 \target variable-command
1143 \section1 \\variable
1144
1145 The \\variable command is for documenting a class member variable
1146 or a constant. The argument is the variable or constant name. The
1147 \\variable command comment includes a \l {brief-command} {\\brief}
1148 command. QDoc generates the documentation based on the text from
1149 \\brief command.
1150
1151 The documentation will be located in the in the associated class,
1152 header file, or namespace documentation.
1153
1154 In case of a member variable:
1155
1156 \badcode *
1157 /\1!
1158 \variable QStyleOption::palette
1159 \brief The palette that should be used when painting
1160 the control
1161 \1/
1162 \endcode
1163
1164 You can also document constants with the \\variable command. For
1165 example, suppose you have the \c Type and \c UserType constants in
1166 the QTreeWidgetItem class:
1167
1168 \code
1169 enum { Type = 0, UserType = 1000 };
1170 \endcode
1171
1172 For these, the \\variable command can be used this way:
1173
1174 \badcode *
1175 /\1!
1176 \variable QTreeWidgetItem::Type
1177
1178 The default type for tree widget items.
1179
1180 \sa UserType, type()
1181 \1/
1182 \endcode
1183
1184 \badcode *
1185 /\1!
1186 \variable QTreeWidgetItem::UserType
1187
1188 The minimum value for custom types. Values below
1189 UserType are reserved by Qt.
1190
1191 \sa Type, type()
1192 \1/
1193 \endcode
1194
1195*/