The text formatting commands indicate how text is to be rendered.
The \a command tells QDoc the next word is a formal parameter name.
A warning is emitted when a formal parameter is not documented or is misspelled, so when you document a function you should mention each formal parameter by name in the function description, preceded by the \a command. The parameter name is then rendered in italics.
The formal parameter name may be enclosed between curly brackets, but that isn't required.
The \c command is used for rendering variable names, user-defined class names, and C++ keywords (for example,
int
and
for
) in the code font.
The command renders its argument using a monospace font. If the text to be rendered in the code font contains spaces, enclose the entire text in curly brackets:
\c {QLineEdit::QLineEdit(const QString &contents, QWidget *parent) : QWidget(parent)}
The \c command accepts the special character
\
within its argument, which renders it as a normal character. So if you want to use nested commands, you must use the
teletype (\tt)
command instead.
The \details and \enddetails commands generates a collapsible <details> element with a <summary> to control the hidden/visible state.
When generating HTML output, use the \details and \enddetails commands to generate a collapsible
<details>
HTML element. The command takes an optional summary string enclosed in curly braces. This optional argument specifies a visible heading for the details.
For example, with the following input:
/*!
\details {QDoc details}
\note You're looking at detailed information.
\enddetails
*/
If QDoc is generating HTML, it will translate these commands to:
<summary>QDoc details</summary><div class="admonition note"><p><b>Note: </b>You're looking at detailed information.</p></div>
QDoc renders this as:
注意: You're looking at detailed information.
For any other output format, QDoc generates the contents as a normal paragraph, ignoring the summary string. This command was introduced to QDoc in Qt6.6.
The \div and \enddiv commands delimit a large or small block of text (which may include other QDoc commands) to which special formatting attributes should be applied.
An argument must be provided in curly braces, as in the QDoc comment shown below. The argument is not interpreted but is used as attribute(s) of the tag that is output by QDoc.
For example, we might want to render an inline image so that it floats to the right of the current block of text:
/*!
\div {class="float-right"}
\inlineimage qml-column.png
\enddiv
*/
If QDoc is generating HTML, it will translate these commands to:
<div class="float-right"><p><img src="images/qml-column.png" /></p></div>
For HTML, the attribute value float-right then will refer to a clause in the style.css file, which in this case could be:
div.float-right { float: right; margin-left: 2em }
注意: 注意, \div command can be nested.
Below you can find an example taken from the index.qdoc file used to generate index.html for Qt 4.7:
\div {class="indexbox guide"}
\div {class="heading"}
Qt Developer Guide
\enddiv
\div {class="indexboxcont indexboxbar"}
\div {class="section indexIcon"} \emptyspan
\enddiv
\div {class="section"}
Qt is a cross-platform application and UI
framework. Using Qt, you can write web-enabled
applications once and deploy them across desktop,
mobile and embedded operating systems without
rewriting the source code.
\enddiv
\div {class="section sectionlist"}
\list
\li \l{Getting Started}
\li \l{Installation} {Installation}
\li \l{how-to-learn-qt.html} {How to learn Qt}
\li \l{tutorials.html} {Tutorials}
\li \l{Qt Examples} {Examples}
\li \l{qt4-7-intro.html} {What's new in Qt 4.7}
\endlist
\enddiv
\enddiv
\enddiv
When all the class attribute values are defined as they are in the style.css file that is used for rendering the Qt documentation, the above example is rendered as: