将事物分组
分组命令将类与定义的组和模块相关联。组用于在文档中生成相关类的列表,而模块则是 Qt 结构的元素。
命令
\分组
\ingroup 命令表示给定的类、页面或其他实体属于某个相关文档组。
一个实体可以属于多个组。
\ingroup 命令的参数是组名,但注意该命令会将该行的其余部分视为其参数的一部分。请确保组名后面有一个换行符。
/*! \class QDir \brief The QDir class provides access to directory structures and their contents. \ingroup io ... */
这将把QDir 类添加到io
组中。这样QDir 的条目就会出现在用(\annotatedlist)命令创建的列表中,该列表的参数是io
。
QDoc 会在 C++ 类、命名空间或头文件参考页面上自动生成指向相关组的链接。例如,上面给出了类 QDir 的文档和下面的\group页面:
/* \group io \title Input/Output and Networking ... */
QDoc 会在QDir 引用页上输出一条语句:
- QDir 是输入/输出和网络的一部分。
对于 HTML 输出,QDoc 还会生成一个指向组页面的链接,作为导航栏(面包屑)的一部分。如果使用了多个 \ingroup 命令,则会选择第一个引用已记录的 \group 的命令。
另请参见\group.
\模块
inmodule 命令将一个类与命令参数指定的模块相关联。
对于 Qt 中的基本类,类的模块由其位置(即目录)决定。然而,对于 ActiveQt 和Qt Widgets Designer 等扩展,类必须与模块明确相关。
该命令的参数是一个模块名称,但请注意,该命令会将该行的其余部分视为其参数的一部分。请确保模块名称后面有一个换行符。
/*!
\class QDesignerTaskMenuExtension
\inmodule QtDesigner
* /
这将确保QDesignerTaskMenuExtension 类包含在Qt Widgets Designer 模块中,例如,这意味着该类将出现在使用{classesbymodule QtDesigner}
参数调用\generatelist命令创建的列表中。
© 2025 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.