本页内容

QDoc 入门

Qt 使用 QDoc 将其文档集生成为 HTML 和 DocBook XML 格式。QDoc 通过一组配置文件,根据 QDoc 注释生成文档。这些注释具有称为“主题”的类型,用于确定该注释是类文档还是属性文档。注释中还可以包含标记,以增强最终输出的布局和格式。

使用 QDoc 生成文档需要以下三项基本素材:

  • QDoc 二进制
  • qdocconf 配置文件
  • Documentation 位于C++ 、QML 和.qdoc 文件中的配置文件

QDoc需要Clang来解析 C++ 头文件和源文件,并解析 \fn 命令中解析函数签名。详情请参阅《为 QDoc 安装 Clang》。

本节旨在介绍创建文档集所需的基本要素。此外,本指南还介绍了编写非 C++ API 文档以及 QML 文档时的特殊注意事项和选项。最后,本指南将提供一个示例项目文档以及一个 QML 类型文档的示例。

有关 QDoc 的具体信息,请参阅《QDoc 手册》。

章节

  1. 为 QDoc 安装 Clang
  2. 创建 QDoc 配置文件
  3. 编写文档
  4. 文档分类
  5. QDoc 警告的排除

© 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.