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 an hidden friend, it is required to prepend the
357 enclosing class name to the function name.
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 should be written as \c{"\fn Foo::operator==(const
369 Foo&, const Foo&)"} and not as the free function \c{"\fn
370 operator==(const Foo&, const Foo&)"}.
371
372 Failure to do so will have QDoc complaining about being unable to
373 resolve the function.
374
375 \note The \\fn command is QDoc's default command: when no
376 topic command can be found in a QDoc comment, QDoc tries to tie
377 the documentation to the following code as if it is the
378 documentation for a function. Hence, it is normally not necessary
379 to include this command when documenting a function, if the
380 function's QDoc comment is written immediately above the function
381 implementation in the \c .cpp file. But it must be present when
382 documenting an inline function in the \c .cpp file that is
383 implemented in the \c .h file.
384
385 \badcode *
386 /\1!
387 \fn bool QToolBar::isAreaAllowed(Qt::ToolBarArea area) const
388
389 Returns \c true if this toolbar is dockable in the given
390 \a area; otherwise returns \c false.
391 \1/
392 \endcode
393
394 \note Running in debug mode (pass the \c {-debug} command line option
395 or set the \c QDOC_DEBUG environment variable before invoking QDoc)
396 can help troubleshoot \\fn commands that QDoc fails to parse. In
397 debug mode, additional diagnostic information is available.
398
399 See also \l {overload-command} {\\overload}.
400
401 \target group-command
402 \section1 \\group
403
404 The \\group command creates a separate page that lists the classes,
405 pages, or other entities belonging to a named group. The argument
406 is the group name.
407
408 A class is included in a group by using the \l {ingroup-command}
409 {\\ingroup} command. Overview pages can also be related to a group
410 using the same command, but the list of overview pages must be
411 requested explicitly using the \l {generatelist-command}
412 {\\generatelist} command (see example below).
413
414 The \\group command is typically followed by a \l {title-command}
415 {\\title} command and a short introduction to the group. The
416 HTML page for the group is written to an \c {.html} file named
417 <lower-case-group-name>.html.
418
419 Each entity in the group is listed as a link (using page title
420 or class name), followed by a decription from the \l {brief-command}
421 {\\brief} command in the entity's documentation.
422
423 \badcode *
424 /\1!
425 \group io
426 \title Input/Output and Networking
427 \1/
428 \endcode
429
430 QDoc generates a group page \c{io.html}.
431
432 Note that overview pages related to the group must be listed
433 explicitly using the \l {generatelist-command} {\\generatelist}
434 command with the \c related argument.
435
436 \badcode *
437 /\1!
438 \group architecture
439
440 \title Architecture
441
442 These documents describe aspects of Qt's architecture
443 and design, including overviews of core Qt features and
444 technologies.
445
446 \generatelist{related}
447 \1/
448 \endcode
449
450 See also \l {ingroup-command} {\\ingroup}, \l {annotatedlist-command}
451 {\\annotatedlist}, \l {generatelist-command} {\\generatelist}, and
452 \l {noautolist-command}{\\noautolist}.
453
454 \target headerfile-command
455 \section1 \\headerfile
456
457 The \\headerfile command is for documenting the global functions,
458 types and macros that are declared in a header file, but not in a
459 namespace. The argument is the name of the header file. The HTML
460 page is written to a \c {.html} file constructed from the header
461 file argument.
462
463 The documentation for a function, type, or macro that is declared
464 in the header file being documented, is included in the header file
465 page using the \l {relates-command} {\\relates} command.
466
467 If the argument doesn't exist as a header file, the \\headerfile
468 command creates a documentation page for the header file anyway.
469
470 \badcode *
471 /\1!
472 \headerfile <QtAlgorithms>
473
474 \title Generic Algorithms
475
476 \brief The <QtAlgorithms> header file provides
477 generic template-based algorithms.
478
479 Qt provides a number of global template functions in \c
480 <QtAlgorithms> that work on containers and perform
481 well-know algorithms.
482 \1/
483 \endcode
484
485 QDoc generates a header file page, \c{qtalgorithms.html}.
486
487 See also \l {inheaderfile-command}{\\inheaderfile}.
488
489 \target macro-command
490 \section1 \\macro
491
492 The \\macro command is for documenting a C++ macro. The argument
493 is the macro in one of three styles: function-like macros like
494 Q_ASSERT(), declaration-style macros like Q_PROPERTY(), and macros
495 without parentheses like Q_OBJECT.
496
497 The \\macro comment must contain a \l {relates-command}
498 {\\relates} command that attaches the macro comment to a class,
499 header file, or namespace. Otherwise, the documentation will be
500 lost.
501
502 \target module-command
503 \section1 \\module
504
505 The \\module creates a page that lists the classes belonging to
506 the module specified by the command's argument. A class included
507 in the module by including the \l {inmodule-command} {\\inmodule}
508 command in the \\class comment.
509
510 The \\module command is typically followed by a \l {title-command}
511 {\\title} and a \l {brief-command} {\\brief} command. Each class
512 is listed as a link to the class reference page followed by the
513 text from the class's \l {brief-command} {\\brief} command. For
514 example:
515
516 \badcode *
517 /\1!
518 \module QtNetwork
519
520 \title Qt Network Module
521
522 \brief Contains classes for writing TCP/IP clients and servers.
523
524 The network module provides classes to make network
525 programming easier and portable. It offers both
526 high-level classes such as QNetworkAccessManager that
527 implements application-level protocols, and
528 lower-level classes such as QTcpSocket, QTcpServer, and
529 QUdpSocket.
530 \1/
531 \endcode
532
533 The \l {noautolist-command} {\\noautolist} command can be used here
534 to omit the automatically generated list of classes at the end.
535
536 See also \l {inmodule-command} {\\inmodule}
537
538 \target namespace-command
539 \section1 \\namespace
540
541 The \\namespace command is for documenting the contents of the C++
542 namespace named as its argument. The reference page QDoc generates
543 for a namespace is similar to the reference page it generates for a
544 C++ class.
545
546 \badcode *
547 /\1!
548 \namespace Qt
549
550 \brief Contains miscellaneous identifiers used throughout the Qt library.
551 \1/
552 \endcode
553
554 Note that in C++, a particular namespace can be used in more
555 than one module, but when C++ elements from different modules
556 are declared in the same namespace, the namespace itself must
557 be documented in one module only. For example, namespace Qt in
558 the example above contains types and functions from both QtCore
559 and QtGui, but it is documented with the \\namespace command
560 only in QtCore.
561
562 \target page-command
563 \section1 \\page
564
565 The \\page command is for creating a stand-alone documentation
566 page.
567
568 The \\page command expects a single argument that represents the
569 name of the file where QDoc should store the page.
570
571 The page title is set using the \l {title-command} {\\title}
572 command.
573
574 \badcode *
575 /\1!
576 \page aboutqt.html
577
578 \title About Qt
579
580 Qt is a C++ toolkit for cross-platform GUI
581 application development. Qt provides single-source
582 portability across Microsoft Windows, macOS, Linux,
583 and all major commercial Unix variants.
584
585 Qt provides application developers with all the
586 functionality needed to build applications with
587 state-of-the-art graphical user interfaces. Qt is fully
588 object-oriented, easily extensible, and allows true
589 component programming.
590
591 ...
592 \1/
593 \endcode
594
595 QDoc renders this page in \c {aboutqt.html}.
596
597 \target property-command
598 \section1 \\property
599
600 The \\property command is for documenting a Qt property. The
601 argument is the full property name.
602
603 A property is defined using the Q_PROPERTY() macro. The macro
604 takes as arguments the property's name and its set, reset and get
605 functions.
606
607 \badcode
608 Q_PROPERTY(QString state READ state WRITE setState)
609 \endcode
610
611 The set, reset and get functions don't need to be documented,
612 documenting the property is sufficient. QDoc will generate a list
613 of the access function that will appear in the property
614 documentation which in turn will be located in the documentation
615 of the class that defines the property.
616
617 The \\property command comment typically includes a \l
618 {brief-command} {\\brief} command. For properties the \l
619 {brief-command} {\\brief} command's argument is a sentence
620 fragment that will be included in a one line description of the
621 property. The command follows the same rules for the
622 description as the \l {variable-command} {\\variable} command.
623
624 \badcode *
625 /\1!
626 \property QPushButton::flat
627 \brief Whether the border is disabled.
628
629 This property's default is false.
630 \1/
631 \endcode
632
633 \target qmlattachedproperty-command
634 \section1 \\qmlattachedproperty
635
636 The \\qmlattachedproperty command is for documenting a QML
637 property that will be attached to some QML type. See
638 \l{Attached Properties and Attached Signal Handlers}
639 {Attached Properties}. The argument is the rest of the line.
640 It must start with the property type, followed by the QML
641 type name where the property is declared, the \c{::}
642 qualifier, and finally the property name.
643
644 For example, to document a boolean QML attached property named
645 \c isCurrentItem for the \c ListView type:
646
647 \badcode *
648 /\1!
649 \qmlattachedproperty bool ListView::isCurrentItem
650
651 This attached property is \c true if this delegate is the current
652 item; otherwise false.
653
654 It is attached to each instance of the delegate.
655
656 This property may be used to adjust the appearance of the current
657 item, for example:
658
659 \snippet doc/src/snippets/declarative/listview/listview.qml isCurrentItem
660 \1/
661 \endcode
662
663 QDoc includes this attached property on the QML reference page for the
664 \l [QML] {ListView} type.
665
666 \note Like \l{qmlproperty-command}{\\qmlproperty}, \\qmlattachedproperty
667 accepts a QML module identifier as part of its argument.
668
669 \target qmlattachedsignal-command
670 \section1 \\qmlattachedsignal
671
672 The \\qmlattachedsignal command is for documenting an attachable
673 \l{Signal and Handler Event System}{signal}. The \\qmlattachedsignal
674 command is used just like the \l{qmlsignal-command} {\\qmlsignal} command.
675
676 The argument is the rest of the line. It should be the name of the
677 QML type where the signal is declared, the \c{::}
678 qualifier, and finally the signal name. For example, a QML
679 attached signal named \c add() in the \c GridView
680 element is documented like this:
681
682 \badcode *
683 /\1!
684 \qmlattachedsignal GridView::add()
685 This attached signal is emitted immediately after an item is added to the view.
686 \1/
687 \endcode
688
689 QDoc includes this documentation on the QML reference page for the
690 \l GridView element.
691
692 \note Like \l{qmlproperty-command}{\\qmlproperty}, \\qmlattachedsignal accepts
693 a QML module identifier as part of its argument.
694
695 \target qmlvaluetype-command
696 \section1 \\qmlvaluetype
697
698 The \\qmlvaluetype command is for documenting a \l [QtQml]
699 {QML Value Types}{value type} for QML. The command takes
700 a type name as its only argument.
701
702 \\qmlvaluetype is functionally identical to the
703 \l {qmltype-command}{\\qmltype} command. The only difference
704 is that the type will be titled (and grouped) as a
705 \e {QML value type}.
706
707 \target qmlclass-command
708 \section1 \\qmlclass
709
710 This command is deprecated. Use \l{qmltype-command} {\\qmltype}
711 instead.
712
713 \target qmlenum-command
714 \section1 \\qmlenum
715
716 The \\qmlenum command is for documenting a QML enumeration. The command
717 takes a single argument: the full name of the enumeration type, including
718 the parent QML type and, optionally, the QML module.
719
720 The enumerators and their descriptions are documented using
721 \qdoccmd {value} commands.
722
723 For example,
724
725 \badcode *
726 /\1!
727 \qmlenum My.Module::Color::Channel
728 \brief Specifies a color channel in the RGB colorspace.
729
730 \value R
731 Red color channel
732
733 \value G
734 Green color channel
735
736 \value B
737 Blue color channel
738 \1/
739 \endcode
740
741 This generates documentation for an enumeration \e Channel, with three
742 enumerators: \e {Color.R}, \e {Color.G}, and \e {Color.B}.
743
744 Alternatively, it's possible to replicate the enumerators' documentation
745 from an existing C++ \qdoccmd {enum} topic, by using the
746 \qdoccmd {qmlenumeratorsfrom} command.
747
748 This command was introduced with Qt 6.10.
749
750 See also \qdoccmd {qmlenumeratorsfrom}.
751
752 \target qmlmethod-command
753 \section1 \\qmlmethod
754
755 The \\qmlmethod command is for documenting a QML method. The
756 argument is the complete method signature, including return
757 type and parameter names and types.
758
759 \badcode *
760 /\1!
761 \qmlmethod void TextInput::select(int start, int end)
762
763 Causes the text from \a start to \a end to be selected.
764
765 If either start or end is out of range, the selection is not changed.
766
767 After having called this, selectionStart will become the lesser, and
768 selectionEnd the greater (regardless of the order passed to this method).
769
770 \sa selectionStart, selectionEnd
771 \1/
772 \endcode
773
774 QDoc includes this documentation on the element reference page for the
775 \l{http://doc.qt.io/qt-5/qml-qtquick-textinput.html#select-method}
776 {TextInput} element.
777
778 \target qmltype-command
779 \section1 \\qmltype
780
781 The \\qmltype command is for documenting a QML type. The command
782 has one argument, which is the name of the QML type.
783
784 If the QML type has an equivalent C++ class, you can specify that class
785 with the \qdoccmd nativetype context command.
786
787 The \l {inqmlmodule-command}{\\inqmlmodule} command documents the
788 QML module the type belongs to. The argument passed to this command
789 must match with a documented \l {qmlmodule-command}{\\qmlmodule}
790 page.
791
792 \badcode *
793 /\1!
794 \qmltype Transform
795 \nativetype QGraphicsTransform
796 \inqmlmodule QtQuick
797
798 \brief Provides a way to build advanced transformations on Items.
799
800 The Transform element is a base type which cannot be
801 instantiated directly.
802 \1/
803 \endcode
804
805 Here, the \e{\\qmltype} comment includes \qdoccmd nativetype
806 to specify that a Transform is the QML counterpart to the
807 C++ class QGraphicsTransform. A \\qmltype comment should
808 always include a \l {since-command} {\\since} command, because all
809 QML types are new. It should also include a \l{brief-command}
810 {\\brief} description. If a QML type is a member of a QML type group,
811 the \\qmltype comment should include one or more \l{ingroup-command}
812 {\\ingroup} commands.
813
814 \note QDoc automatically detects QML singleton types when the corresponding
815 C++ class uses the \c{QML_SINGLETON} macro. For such types, using
816 \qdoccmd {qmltype} is sufficient, as the singleton nature will be detected
817 and documented automatically.
818
819 \target qmlsingletontype-command
820 \section1 \\qmlsingletontype
821
822 The \\qmlsingletontype command is for explicitly documenting a QML singleton type.
823 This command is functionally identical to \l{qmltype-command}{\\qmltype}, but it
824 explicitly marks the type as a singleton regardless of the C++ implementation.
825
826 A QML singleton type ensures only one instance exists in the QML engine.
827 The singleton designation is displayed in the generated documentation with
828 a "(Singleton)" indicator in the title and an explanatory note.
829
830 \badcode *
831 /\1!
832 \qmlsingletontype Settings
833 \inqmlmodule MyApp
834
835 \brief Provides application-wide settings as a singleton.
836
837 The Settings type is a singleton that maintains application
838 configuration. Access it directly without instantiation.
839 \1/
840 \endcode
841
842 For C++ classes that use the \c{QML_SINGLETON} macro, prefer using
843 \qdoccmd {qmltype} instead, as QDoc will automatically detect the singleton
844 nature from the C++ code.
845
846 \target qmlproperty-command
847 \section1 \\qmlproperty
848
849 The \\qmlproperty command is for documenting a QML property. The
850 argument is the rest of the line. The argument text should be the
851 property type, followed by the QML type name, the \c{::}
852 qualifier, and finally the property name. If we have a QML
853 property named \c x in QML type \c Translate, and the property
854 has type \c {real}, the \\qmlproperty for it would look like this:
855
856 \badcode *
857 /\1!
858 \qmlproperty real Translate::x
859
860 The translation along the X axis.
861 \1/
862 \endcode
863
864 QDoc includes this QML property on the QML reference page for the
865 \l [QML] {Translate} type.
866
867 The \l{default-command}{\\default} command is used to document the
868 default value of a property:
869
870 \badcode
871 \qmlproperty real AxisHelper::gridOpacity
872 \default 0.5
873 \endcode
874
875 If the QML property exposes a C++ enum, the QML property is defined
876 with type \c{enumeration}:
877
878 \badcode
879 \qmlproperty enumeration ParticleShape3D::ShapeType
880 \endcode
881
882 Properties with enumeration type and those that hold a bit-wise
883 combination of flags can use the \l{value-command}{\\value} command
884 to document the acceptable values.
885
886 \badcode
887 \qmlproperty enumeration Buffer::textureFilterOperation
888 Specifies the texture filtering mode...
889 \value Buffer.Nearest Use nearest-neighbor filtering.
890 \endcode
891
892 QDoc also accepts a fully qualified property name, including the
893 QML module identifier:
894
895 \badcode
896 \qmlproperty bool QtQuick.Controls::Button::highlighted
897 \endcode
898
899 If specified, the module identifier (above, \c {QtQuick.Controls})
900 must match with the value passed to the \l {inqmlmodule-command}{\\inqmlmodule}
901 command in the associated \\qmltype documentation. If the name of
902 the QML type the property belongs to is unique across all types in
903 the documentation project, the module identifier can be omitted.
904
905 \target qmlsignal-command
906 \section1 \\qmlsignal
907
908 The \\qmlsignal command is for documenting a QML signal.
909 The argument is the rest of the line. The arguments should be: the QML type
910 where the signal is declared, the \c{::} qualifier, and finally the signal
911 name. If we have a QML signal named \c clicked(), the documentation for it
912 would look like this:
913
914 \badcode *
915 /\1!
916 \qmlsignal MouseArea::clicked(MouseEvent mouse)
917
918 This signal is emitted when there is a click. A click is defined as a
919 press followed by a release, both inside the MouseArea.
920 \1/
921 \endcode
922
923 QDoc includes this documentation on the QML reference page for the
924 \l [QML] {MouseArea} type.
925
926 \note Like \l{qmlproperty-command}{\\qmlproperty}, \\qmlsignal
927 accepts a QML module identifier as part of its argument.
928
929 \target qmlmodule-command
930 \section1 \\qmlmodule
931
932 Use the \c{\qmlmodule} command to create a \c QML module page. A QML
933 module page is a collection of QML types or any related material. The
934 command takes an optional \c <VERSION> number argument, and is similar
935 to the \l{group-command}.
936
937 A QML type is associated with a module by adding the
938 \l{inqmlmodule-command}{\\inqmlmodule} command to the comment-block that
939 documents the type. You can link to any member of a QML module using the
940 module name and two colons (\c{::}) prefix.
941
942 \badcode *
943 /\1!
944 A link to the TabWidget of the UI Component is \l {UIComponent::TabWidget}.
945 \1/
946 \endcode
947
948 QDoc generates a page for the module that lists all the members of the
949 module.
950
951 \badcode *
952 /\1!
953 \qmlmodule ClickableComponents
954
955 This is a list of the Clickable Components set. A Clickable component
956 responds to a \c clicked() event.
957 \1/
958 \endcode
959
960 \target inqmlmodule-command
961 \section1 \\inqmlmodule
962
963 A QML type is marked as being available under a specific QML module
964 import by inserting the \\inqmlmodule command in a
965 \l {qmltype-command}{\\qmltype} topic. The command takes the module
966 (import) name, without a version number, as the only argument.
967
968 The QML module name must match with a QML module documented with
969 the (\l{qmlmodule-command}{\\qmlmodule} command).
970
971 \badcode *
972 /\1!
973 \qmltype ClickableButton
974 \inqmlmodule ClickableComponents
975
976 A clickable button that responds to the \c click() event.
977 \1/
978 \endcode
979
980 QDoc outputs a row \e {Import statement: import <qmlmodule>}
981 in a table at the top of the QML type reference page.
982
983 When linking to QML types, the QML module identifier may appear in
984 the link target. For example:
985
986 \badcode
987 \l {ClickableComponents::}{ClickableButton}
988 \endcode
989
990 Links to the type reference page, with \e ClickableButton as the
991 link text.
992
993 \target instantiates-command
994 \section1 \\instantiates
995
996 The \\instantiates command is deprecated since Qt 6.8.
997 Use \qdoccmd nativetype instead.
998
999
1000 \target nativetype-command
1001 \section1 \\nativetype
1002
1003 The \\nativetype-command must be used in conjunction with the
1004 \qdoccmd qmltype topic command. The command takes a C++ class as its
1005 argument. If QDoc cannot find the C++ class, it issues a warning. This
1006 command was introduced with Qt 6.8.
1007
1008 Use the \\nativetype-command to specify what the type is called in C++.
1009 This ensures that the requisites block generated in the documentation for
1010 the QML type contains an "In C++" entry. The C++ class will have a
1011 corresponding "In QML" entry.
1012
1013 Any one QML type can only have one native type. QDoc issues a warning if
1014 redefinition occurs. However, multiple QML types can have the same C++
1015 class as their native type. The C++ class documentation will contain a list
1016 of all corresponding types in QML.
1017
1018 \badcode *
1019 /\1!
1020 \qmltype Transform
1021 \nativetype QGraphicsTransform
1022 \inqmlmodule QtQuick
1023
1024 \brief Provides a way to build advanced transformations on Items.
1025
1026 The Transform element is a base type which cannot be
1027 instantiated directly.
1028 \1/
1029 \endcode
1030
1031 Here, the \e{\\qmltype} topic includes \e{\\nativetype} to specify that a
1032 Transform is called QGraphicsTransform in C++.
1033
1034
1035 \target typealias-command
1036 \section1 \\typealias
1037
1038 The \\typealias command is similar to \l {typedef-command}{\\typedef},
1039 but specific to documenting a C++ type alias:
1040
1041 \code
1042 class Foo
1043 {
1044 public:
1045 using ptr = void*;
1046 // ...
1047 }
1048 \endcode
1049
1050 This can be documented as
1051
1052 \badcode *
1053 /\1!
1054 \typealias Foo::ptr
1055 \1/
1056 \endcode
1057
1058 The \\typealias command was introduced in QDoc 5.15.
1059
1060 See also \l {typedef-command}{\\typedef}.
1061
1062 \target typedef-command
1063 \section1 \\typedef
1064
1065 The \\typedef command is for documenting a C++ typedef. The
1066 argument is the name of the typedef. The documentation for
1067 the typedef will be included in the reference documentation
1068 for the class, namespace, or header file in which the typedef
1069 is declared. To relate the \\typedef to a class, namespace, or
1070 header file, the \\typedef comment must contain a
1071 \l {relates-command} {\\relates} command.
1072
1073 \badcode *
1074 /\1!
1075 \typedef QObjectList
1076 \relates QObject
1077
1078 Synonym for QList<QObject>.
1079 \1/
1080 \endcode
1081
1082 Other typedefs are located on the reference page for the class
1083 that defines them.
1084
1085 \badcode *
1086 /\1!
1087 \typedef QList::Iterator
1088
1089 Qt-style synonym for QList::iterator.
1090 \1/
1091 \endcode
1092
1093 See also \l {typealias-command}{\\typealias}.
1094
1095 \target variable-command
1096 \section1 \\variable
1097
1098 The \\variable command is for documenting a class member variable
1099 or a constant. The argument is the variable or constant name. The
1100 \\variable command comment includes a \l {brief-command} {\\brief}
1101 command. QDoc generates the documentation based on the text from
1102 \\brief command.
1103
1104 The documentation will be located in the in the associated class,
1105 header file, or namespace documentation.
1106
1107 In case of a member variable:
1108
1109 \badcode *
1110 /\1!
1111 \variable QStyleOption::palette
1112 \brief The palette that should be used when painting
1113 the control
1114 \1/
1115 \endcode
1116
1117 You can also document constants with the \\variable command. For
1118 example, suppose you have the \c Type and \c UserType constants in
1119 the QTreeWidgetItem class:
1120
1121 \code
1122 enum { Type = 0, UserType = 1000 };
1123 \endcode
1124
1125 For these, the \\variable command can be used this way:
1126
1127 \badcode *
1128 /\1!
1129 \variable QTreeWidgetItem::Type
1130
1131 The default type for tree widget items.
1132
1133 \sa UserType, type()
1134 \1/
1135 \endcode
1136
1137 \badcode *
1138 /\1!
1139 \variable QTreeWidgetItem::UserType
1140
1141 The minimum value for custom types. Values below
1142 UserType are reserved by Qt.
1143
1144 \sa Type, type()
1145 \1/
1146 \endcode
1147
1148*/