将事物分组
分组命令将类与定义的组和模块相关联。组用于在文档中生成相关类的列表,而模块则是 Qt 结构的元素。
命令
\ingroup
\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
\inmodule 命令将一个类与命令参数指定的模块关联起来。
对于 Qt 中的基本类,类的模块由其位置(即目录)决定。但是,对于 ActiveQt 和Qt Widgets Designer 等扩展,类必须与模块明确相关。
该命令的参数是模块名称,但请注意,该命令会将该行的其余部分视为其参数的一部分。请确保模块名称后面有一个换行符。
/*!
\class QDesignerTaskMenuExtension
\inmodule QtDesigner
* /
这将确保QDesignerTaskMenuExtension 类包含在Qt Widgets Designer 模块中,例如,这意味着该类将出现在通过调用以 \generatelist{classesbymodule QtDesigner} 命令创建的列表中。
另请参见 \module和 \generatelist.
© 2026 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.