对事物的分类
分组命令将类与已定义的组和模块相关联。生成文档中相关类列表时会用到这些组,而模块则是 Qt 结构中的组成部分。
命令
\ingroup
\ingroup 命令用于指示给定的类、页面或其他实体属于某个相关的文档组。
一个实体可以属于多个组。
\ingroup 命令的参数是一个组名,但请注意,该命令会将该行剩余部分视为其参数的一部分。请确保组名后跟一个换行符。
/*!
\class QDir
\brief The QDir class provides access to directory
structures and their contents.
\ingroup io
...
*/QDir 这将把“QDir ”类添加到“io ”组中。随后,例如通过 \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.