带注释的 Qtgui.qdocconf

本文档详细介绍了典型的 Qt 5 qdocconf 文件。内容摘自Qt GUI 中的qtgui.qdocconf文件。

下面是qtgui.qdocconf 文件的完整内容。后续部分将详细讨论 qdocconf 文件中的每一条语句。

include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)

project                 = QtGui
description             = Qt GUI Reference Documentation
url                     = https://doc.qt.io/qt
version                 = $QT_VERSION

examplesinstallpath     = gui

qhp.projects            = QtGui

qhp.QtGui.file         = qtgui.qhp
qhp.QtGui.namespace           = org.qt-project.qtgui.$QT_VERSION_TAG
qhp.QtGui.virtualFolder       = qtgui
qhp.QtGui.indexTitle          = Qt GUI
qhp.QtGui.indexRoot           =

qhp.QtGui.subprojects         = classes
qhp.QtGui.subprojects.classes.title = C++ Classes
qhp.QtGui.subprojects.classes.indexTitle = Qt GUI C++ Classes
qhp.QtGui.subprojects.classes.selectors = class headerfile
qhp.QtGui.subprojects.classes.sortPages = true

tagfile                 = qtgui.tags

depends += \
    qtcore \
    qtnetwork \
    qtopengl \
    qtsvg \
    qtqml \
    qtquick \
    qtwidgets \
    qtdoc

headerdirs  += ..

sourcedirs  += .. \
               ../../../examples/gui/doc/src

excludedirs  = ../../../examples/gui/doc/src/tmp

exampledirs += ../../../examples/gui \
               snippets

imagedirs   += images \
               ../../../examples/gui/doc/images \
               ../../../doc/src/images
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)

QDoc 会从$QT_INSTALL_DOCS 变量指定的目录中继承默认模板、宏和设置。qmake 会输出该变量的值。

qmake -query

另请参阅:include。

project                 = QtGui

project 变量用于设置 QDoc 构建的名称。该名称还将用于生成索引文件,在本例中即为qtgui.index。索引文件的名称不会采用项目名称中的大写字母。

另请参阅:project。

description             = Qt GUI Reference Documentation

对相关项目的简要描述。

url                     = https://doc.qt.io/qt-5

url 变量保存项目的基址。

该 URL 将存储在为该项目生成的索引文件中。QDoc 在构建指向索引中列出的内容的外部链接时,将使用此 URL 作为基准 URL。

注意: 如果在运行 QDoc 时指定了 –installdir 参数,QDoc 将省略此值。

examplesinstallpath     = gui

examplesinstallpath 变量表示示例将安装在父目录 examples 下的gui目录中(对于 Qt,该目录为 $QT_INSTALL_EXAMPLES)。

注意: examplepath 变量必须与 exampledirs 中指定的示例目录一致。

注意:可以 针对特定情况覆盖examplesinstallpath \example 使用 \meta 。

另请参阅:examplesinstallpath、exampledirs 和 \meta。

qhp.projects    = QtGui
qhp.QtGui.file  = qtgui.qhp

以下参数用于创建 QHP 文件(.qhp)。qhelpgenerator程序可将 QHP 文件转换为 QCH 文件(.qch),该文件可在Qt Assistant 或Qt Creator 中打开。

qhp.QtGui.namespace           = org.qt-project.qtgui.$QT_VERSION_TAG

一个唯一的标识符,使QHelpEngine 能够从给定的链接中检索帮助文件。该命名空间还用作指向帮助文件的链接的基础 URL。

qhp.QtGui.virtualFolder       = qtgui

虚拟文件夹将文档集中到一个位置。虚拟文件夹将成为压缩帮助文件中所有引用文件的根目录。

当两本手册位于同一个虚拟文件夹中时,可以使用相对路径引用另一本手册中的章节。虚拟文件夹标签是必填项,且文件夹名称中不得包含任何“/”。

qhp.QtGui.indexTitle          = Qt GUI

这是包含相关内容的页面的标题。

qhp.QtGui.indexRoot           =

指定要为其生成文档的根(命名空间)页面的标题。通常定义为空字符串。

qhp.QtGui.subprojects         = classes
qhp.QtGui.subprojects.classes.title = C++ Classes
qhp.QtGui.subprojects.classes.indexTitle = Qt GUI C++ Classes

子项目指定了将在该项目目录中显示的章节。在此示例中,显示在 Assistant 侧边栏中的子项目名为“C++ 类”,其索引是标题为“Qt GUI C++ 类”的页面。

qhp.QtGui.subprojects.classes.selectors = class headerfile

列出了所有 C++ 类和头文件。

有关详细信息,请参阅“创建帮助项目文件”。

tagfile                 = ../../../doc/qtgui/qtgui.tags

此项指定了当 QDoc 生成 HTML 时需要写入的 Doxygen 标签文件。

depends += \
   qtcore \
   qtnetwork \
   qtopengl \
   qtsvg \
   qtqml \
   qtquick \
   qtwidgets \
   qtdoc

指定 QDoc 为生成Qt GUI 的输出所需加载的模块。QDoc 会加载 depends 语句中列出的所有模块的索引文件,以便链接到这些模块中的页面。

headerdirs  += ..

将父目录添加到包含与.cpp源文件相关的头文件的目录列表中。

sourcedirs  += .. \
               ../../../examples/gui/doc/src

将指定的目录添加到包含文档中使用的.cpp和.qdoc文件的目录列表中。

excludedirs  = ../../../examples/gui/doc/src/tmp

excludedirs 变量用于列出不应被 QDoc 处理的目录,即使这些目录已被sourcedirs 或headerdirs 变量包含在内。

执行时,QDoc 将忽略列表中列出的目录。另请参阅:excludefiles。

exampledirs += ../../../examples/gui \
               snippets

另请参阅:examples、examplesinstallpath。

将指定的两个目录添加到包含示例文件源代码的目录列表中。

如果 QDoc 同时遇到exampledirs 和examples ,它将首先在examples 目录中查找。QDoc 将接受它找到的第一个匹配文件。QDoc 将在指定的目录中进行搜索,而非其子目录。

imagedirs   += images \
               ../../../examples/gui/doc/images \
               ../../../doc/src/images \

将上述指定的目录添加到可查找图像的目录列表中。

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