Miscellaneous
These commands provide miscellaneous functions connected to the visual appearance of the documentation, and to the process of generating the documentation.
\annotatedlist
The \annotatedlist command expands to a list of the members of a group, each member listed with its brief text. Below is an example from the Qt Reference Documentation:
/ *! ... \section1 Drag and Drop Classes These classes deal with drag and drop and the necessary mime type encoding and decoding. \annotatedlist draganddrop * /
This generates a list of all the C++ classes and/or QML types in the draganddrop group. A C++ class or QML type in the draganddrop group will have \ingroup draganddrop in its \class or \qmltype comment.
\generatelist
The \generatelist command expands to a list of links to the documentation entities in a group. Below is an example from the Qt Reference Documentation:
/ *! \page classes.html \title All Classes For a shorter list that only includes the most frequently used classes, see \l{Qt's Main Classes}. \generatelist classes Q * /
This generates the All Classes page. The command accepts the following arguments:
annotatedclasses
The annotatedclasses
argument provides a table containing the names of all the classes, and a description of each class. Each class name is a link to the class's reference documentation. For example:
QDial | Rounded range control (like a speedometer or potentiometer) |
QDialog | The base class of dialog windows |
QDir | Access to directory structures and their contents |
A C++ class is documented with the \class command. The annotation for the class is taken from the argument of the class comment's \brief command.
classes <prefix>
The classes
argument provides a complete alphabetical list of the classes. The second argument, <prefix>
, is the common prefix for the class names. The class names will be sorted on the character that follows the common prefix. e.g. The common prefix for the Qt classes is Q
. The common prefix argument is optional. If no common prefix is provided, the class names will be sorted on their first character.
Each class name becomes a link to the class's reference documentation. This command is used to generate the All Classes page this way:
/ *! \page classes.html \title All Classes \ingroup classlists \brief Alphabetical list of classes. This is a list of all Qt classes. For a list of the classes provided for compatibility with Qt3, see \l{Qt3 Support Classes}. For classes that have been deprecated, see the \l{Obsolete Classes} list. \generatelist classes Q * /
A C++ class is documented with the \class command.
classesbymodule
When this argument is used, a second argument is required, which specifies the module whose classes are to be listed. QDoc generates a table containing those classes. Each class is listed with the text of its \brief command.
For example, this command can be used on a module page as follows:
/ *! \page phonon-module.html \module Phonon \title Phonon Module \ingroup modules \brief Contains namespaces and classes for multimedia functionality. \generatelist{classesbymodule Phonon} ... * /
Each class that is a member of the specified module must be marked with the \inmodule command in its \class comment.
compatclasses
The compatclasses
argument generates a list in alphabetical order of the support classes. It is normally used only to generate the Qt3 Support Classes page this way:
/ *! \page compatclasses.html \title Qt3 Support Classes \ingroup classlists \brief Enable porting of code from Qt 3 to Qt 4. These are the classes that Qt provides for compatibility with Qt 3. Most of these are provided by the Qt3Support module. \generatelist compatclasses * /
A support class is identified in the \class comment with the \compat command.
functionindex
The functionindex
argument provides a complete alphabetical list of all the documented member functions. It is normally used only to generate the Qt function index page this way:
/ *! \page functions.html \title All Functions \ingroup funclists \brief All documented Qt functions listed alphabetically with a link to where each one is declared. This is the list of all documented member functions and global functions in the Qt API. Each function has a link to the class or header file where it is declared and documented. \generatelist functionindex * /
legalese
The legalese
argument tells QDoc to generate a complete list of licenses in the documentation. Each license is identified using the \legalese command. This command is used to generate the Qt license information page this way:
/ *! \page licenses.html \title Other Licenses Used in Qt \ingroup licensing \brief Information about other licenses used for Qt components and third-party code. Qt contains some code that is not provided under the \l{GNU General Public License (GPL)}, \l{GNU Lesser General Public License (LGPL)} or the \l{Qt Commercial Edition}{Qt Commercial License Agreement}, but rather under specific licenses from the original authors. Some pieces of code were developed by Digia and others originated from third parties. This page lists the licenses used, names the authors, and links to the places where it is used. Digia gratefully acknowledges these and other contributions to Qt. We recommend that programs that use Qt also acknowledge these contributions, and quote these license statements in an appendix to the documentation. See also: \l{Licenses for Fonts Used in Qt for Embedded Linux} \generatelist legalese * /
mainclasses
The mainclasses
argument tells QDoc to generate an alphabetical list of the main classes. A class is marked as a main class by including a \mainclass command in the \class comment.
Note: The Qt documentation no longer includes a main classes page, but you can generate one for your main classes if you want it.
overviews
The overviews
argument is used to tell QDoc to generate a list by concatenating the contents of all the \group pages. Qt uses it to generate the overviews page this way:
/ *! \page overviews.html \title All Overviews and HOWTOs \generatelist overviews * /
related
The related
argument is used in combination with the \group and \ingroup commands to list all the overviews related to a specified group. For example, the page for the Programming with Qt page is generated this way:
/ *! \group qt-basic-concepts \title Programming with Qt \brief The basic architecture of the Qt cross-platform application and UI framework. Qt is a cross-platform application and UI framework for writing web-enabled applications for desktop, mobile, and embedded operating systems. This page contains links to articles and overviews explaining key components and techniuqes used in Qt development. \generatelist {related} * /
Each page listed on this group page contains the command:
\ingroup qt-basic-concepts
service
The service
argument tells QDoc to generate an alphabetical list of the services. Each service name is a link to the service's reference documentation.
A service is identified with the \service command.
Note: This command and the \service command are not used in the Qt documentation.
\if
The \if command and the corresponding \endif command enclose parts of a QDoc comment that only will be included if the condition specified by the command's argument is true.
The command reads the rest of the line and parses it as an C++ #if statement.
/ *! \if defined(opensourceedition) \b{Note:} This edition is for the development of \l{Qt Open Source Edition} {Free and Open Source} software only; see \l{Qt Commercial Editions}. \endif * /
This QDoc comment will only be rendered if the opensourceedition
preprocessor symbol is defined, and specified in the defines variable in the configuration file to make QDoc process the code within #ifdef and #endif:
defines = opensourceedition
You can also define the preprocessor symbol manually on the command line. For more information see the documentation of the defines variable.
See also \endif, \else, defines and falsehoods.
\endif
The \endif command and the corresponding \if command enclose parts of a QDoc comment that will be included if the condition specified by the \if command's argument is true.
For more information, see the documentation of the \if command.
See also \if, \else, defines and falsehoods.
\else
The \else command specifies an alternative if the condition in the \if command is false.
The \else command can only be used within \if...\endif commands, but is useful when there is only two alternatives.
/ *! The Qt 3 support library is provided to keep old source code working. In addition to the \c Qt3Support classes, Qt 4 provides compatibility functions when it's possible for an old API to cohabit with the new one. \if !defined(QT3_SUPPORT) \if defined(QT3_SUPPORTWARNINGS) The compiler emits a warning when a compatibility function is called. (This works only with GCC 3.2+ and MSVC 7.) \else To use the Qt 3 support library, you need to have the line QT += qt3support in your .pro file (qmake automatically define the QT3_SUPPORT symbol, turning on compatibility function support). You can also define the symbol manually (for example, if you don't want to link against the \c Qt3Support library), or you can define \c QT3_SUPPORT_WARNINGS instead, telling the compiler to emit a warning when a compatibility function is called. (This works only with GCC 3.2+ and MSVC 7.) \endif \endif * /
If the QT3_SUPPORT
is defined, the comment will be rendered like this:
The Qt 3 support library is provided to keep old source code working.
In addition to the Qt3Support classes, Qt 4 provides compatibility functions when it's possible for an old API to cohabit with the new one.
If QT3_SUPPORT
is not defined but QT3_SUPPORT_WARNINGS
is defined, the comment will be rendered like this:
The Qt 3 support library is provided to keep old source code working.
In addition to the Qt3Support classes, Qt 4 provides compatibility functions when it's possible for an old API to cohabit with the new one.
The compiler emits a warning when a compatibility function is called. (This works only with GCC 3.2+ and MSVC 7.)
If none of the symbols are defined, the comment will be rendered as
The Qt 3 support library is provided to keep old source code working.
In addition to the
Qt3Support
classes, Qt 4 provides compatibility functions when it's possible for an old API to cohabit with the new one.To use the Qt 3 support library, you need to have the line QT += qt3support in your .pro file (qmake automatically define the QT3_SUPPORT symbol, turning on compatibility function support).
You can also define the symbol manually (e.g., if you don't want to link against the
Qt3Support
library), or you can defineQT3_SUPPORT_WARNINGS
instead, telling the compiler to emit a warning when a compatibility function is called. (This works only with GCC 3.2+ and MSVC 7.)
See also \if, \endif, defines and falsehoods.
\include
The \include command sends all or part of the file specified by its first argument to the QDoc input stream to be processed as a QDoc comment snippet. This command is often assigned the alias, input, in the QDoc configuration file, for example alias.include = input.
The command is useful when some snippet of commands and text is to be used in multiple places in the documentation. In that case, move the snippet into a separate file and use the \include command wherever you want to insert the snippet into the documentation. To prevent QDoc from reading the file as a stand-alone page of documentation, we recommend that you use the .qdocinc
extension for these include files.
The command can have either one or two arguments. The first argument is always a file name. The contents of the file must be QDoc input, in other words, a sequence of QDoc commands and text, but without the enclosing QDoc comment /
*!
... *
/
delimiters. If you want to include the entire named file, don't use the second argument. If you want to include only part of the file, see the two argument form below. Here is an example of the one argument form:
/ *! \page corefeatures.html \title Core Features \include examples/signalandslots.qdocinc \include examples/objectmodel.qdocinc \include examples/layoutmanagement.qdocinc * /
QDoc renders this page as shown here.
\include filename snippet-identifier
It is a waste of time to make a separate .qdocinc
file for every QDoc include snippet you want to use in multiple places in the documentation, especially given that you probably have to put the copyright/license notice in every one of these files. So if you have a large number of snippets to be included, you can put them all in a single file if you want, and surround each one with:
//! [snippet-id1] QDoc commands and text... //! [snippet-id1] //! [snippet-id2] More QDoc commands and text... //! [snippet-id2]
Then you can use the two-argument form of the command:
\input examples/signalandslots.qdocinc snippet-id2 \input examples/objectmodel.qdocinc another-snippet-id
It works as expected. The sequence of QDoc commands and text found between the two tags with the same name as the second argument is sent to the QDoc input stream. You can even nest these snippets, although it's not clear why you would want to do that.
\meta
The \meta command is mainly used for including metadata in DITA XML files. It is also used when generating HTML output for specifying the maintainer(s) of a C++ class.
The command has two arguments: the first argument is the name of the metadata attribute, and the second argument is the value for the attribute. Each argument should be enclosed in curly brackets, as shown in this example:
/ *! \class QWidget \brief The QWidget class is the base class of all user interface objects. \ingroup basicwidgets \meta {technology} {User Interface} \meta {platform} {OS X 10.6} \meta {platform} {Symbian} \meta {platform} {MeeGo} \meta {audience} {user} \meta {audience} {programmer} \meta {audience} {designer} * /
When running QDoc to generate HTML, the example above will have no effect on the generated output, but if you run QDoc to generate DITA XML, the example will generate the following:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE cxxClass PUBLIC "-//NOKIA//DTD DITA C++ API Class Reference Type v0.6.0//EN" "dtd/cxxClass.dtd"> <!--qwidget.cpp--> <cxxClass id="id-9a14268e-6b09-4eee-b940-21a00a0961df"> <apiName>QWidget</apiName> <shortdesc>the QWidget class is the base class of all user interface objects.</shortdesc> <prolog> <author>Qt Development Frameworks</author> <publisher>Qt Project</publisher> <copyright> <copyryear year="2014"/> <copyrholder>Qt Project</copyrholder> </copyright> <permissions view="all"/> <metadata> <audience type="designer"/> <audience type="programmer"/> <audience type="user"/> <category>Class reference</category> <prodinfo> <prodname>Qt Reference Documentation</prodname> <vrmlist> <vrm version="4" release="7" modification="3"/> </vrmlist> <component>QtGui</component> </prodinfo> <othermeta name="platform" content="MeeGo"/> <othermeta name="platform" content="Symbian"/> <othermeta name="platform" content="OS X 10.6"/> <othermeta name="technology" content="User Interface"/> </metadata> </prolog>
In the example output, several values have been set using default values obtained from the QDoc configuration file. See Generating DITA XML Output for details.
\omit
The \omit command and the corresponding \endomit command delimit parts of the documentation that you want QDoc to skip. For example:
/ *! \table \row \li Basic Widgets \li Basic GUI widgets such as buttons, comboboxes and scrollbars. \omit \row \li Component Model \li Interfaces and helper classes for the Qt Component Model. \endomit \row \li Database Classes \li Database related classes, e.g. for SQL databases. \endtable * /
QDoc renders this as:
Basic Widgets | Basic GUI widgets such as buttons, comboboxes and scrollbars. |
Database Classes | Database related classes, e.g. for SQL databases. |
\raw (avoid)
The \raw command and the corresponding \endraw command delimit a block of raw mark-up language code.
Note: Avoid using this command if possible, because it generates DITA XML code that causes problems. If you are trying to generate special table or list behavior, try to get the behavior you want using the \span and \div commands in your \table or \list.
The command takes an argument specifying the code's format. Currently, the only supported format is HTML.
The \raw command is useful if you want some special HTML effects in your documentation.
/ *! Qt has some predefined QColor objects. \raw HTML <style type="text/css" id="colorstyles"> #color-blue { background-color: #0000ff; color: #ffffff } #color-darkBlue { background-color: #000080; color: #ffffff } #color-cyan { background-color: #00ffff; color: #000000 } </style> <p> <tt id="color-blue">Blue(#0000ff)</tt>, <tt id="color-darkBlue">dark blue(#000080)</tt> and <tt id="color-cyan">cyan(#00ffff)</tt>. </p> \endraw * /
QDoc renders this as:
Qt has some predefined QColor objects.
Blue(#0000ff), dark blue(#000080) and cyan(#00ffff).
Note: But you can achieve the exact same thing using qdoc commands. In this case, all you have to do is include the color styles in your style.css file. Then you can write:
\tt {\span {id="color-blue"} {Blue(#0000ff)}}, \tt {\span {id="color-darkBlue"} {dark blue(#000080)}} and \tt {\span {id="color-cyan"} {cyan(#00ffff)}}.
...which is rendered as:
Blue(#0000ff)
, dark blue(#000080)
and cyan(#00ffff)
.
\unicode
The \unicode command allows you to insert an arbitrary Unicode character in the document.
The command takes an argument specifying the character as an integer. By default, base 10 is assumed, unless a '0x' or '0' prefix is specified (for base 16 and 8, respectively). For example:
O G\unicode{0xEA}nio e as Rosas \unicode 0xC0 table en famille avec 15 \unicode 0x20AC par jour \unicode 0x3A3 \e{a}\sub{\e{i}}
QDoc renders this as:
O Gênio e as Rosas
À table en famille avec 15 € par jour
Σ ai
© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.