支持派生工程

Some configuration variables allow you to use QDoc to support Qt-based projects. They allow your project to contain links to the online Qt documentation, which means that QDoc will be able to create links to the class reference documentation, without any explicit linking command.

description

The description variable holds a short description of the associated project.

另请参阅 project .

indexes

indexes variable defines a set of paths to index files to load.

indexes = \
    $QT_INSTALL_DOCS/qtcore/qtcore.index \
    $SOME_OTHER_PROJECT/doc/foo.index
					

indexes variable provides an alternative to depends for defining project's dependencies. As direct paths are provided, no -indexdir command line option(s) are required when invoking QDoc.

It is possible to define dependencies using either variable. Qt documentation only uses the depends 变量。

另请参阅 depends , project and url .

project

project variable provides a name for the project associated with the .qdocconf file. This is a mandatory variable that all projects must set.

The project's name is used to form a file name for the associated project's index 文件。

project = QtCreator
					

This will cause an index file called qtcreator.index to be created.

If the project name contains whitespace or special characters, these are replaced with dashes ('-') in the generated index file name.

另请参阅 depends , indexes ,和 description .

url

url variable holds the base URL for the documentation associated with the current project.

The URL is stored in the generated index file for the project. When we use the index on its own, QDoc will use this as the base URL when constructing links to classes, functions, and other things listed in the index.

project     = QtCore
description = Qt Core Reference Documentation
url         = https://doc.qt.io/qt/
...
					

This ensures that whenever QDoc generates references to entities in the Qt Core module, the base URL is https://doc.qt.io/qt/ .

另请参阅 depends , indexes and url.examples .

url.examples

url.examples variable holds the base URL for the examples associated with the current project.

If defined, a link to the example project directory is generated at the end of each example documentation page. The url.examples variable refers to the root directory of the examples related to this project; it can be a link to an online repository (starting with http:// or https:// ), or to the local file system ( file:// ).

url.examples is not defined, QDoc will output a list of example's files and images instead.

For example, given these definitions:

url.examples = "https://code.qt.io/cgit/qt/qtbase.git/tree/examples/"
examplesinstallpath = corelib
					

Then, for the following \example 命令:

/*!
    \example threads/semaphores
    ...
*/
					

QDoc generates a link to https://code.qt.io/cgit/qt/qtbase.git/tree/examples/corelib/threads/semaphores .

If the URL contains more components (for example, a query string) after the example path, \1 can be used as a placeholder for the path:

url.examples = "https://code.qt.io/cgit/qt/qtbase.git/tree/examples/\1?h=$QT_VER"
examplesinstallpath = corelib
					

Given the same \example command as above and assuming that $QT_VER expands to 5.13 , the generated URL is https://code.qt.io/cgit/qt/qtbase.git/tree/examples/corelib/threads/semaphores?h=5.13 .

url.examples variable was introduced in QDoc version 5.13.

另请参阅 url , examplesinstallpath ,和 \example .

How to Support Derived Projects

This feature makes use of the comprehensive indexes generated by QDoc when it creates the Qt reference documentation.

例如, qtgui.qdocconf (the configuration file for Qt GUI) contains the following variable definitions:

project     = QtGui
description = Qt GUI Reference Documentation
url         = http://doc.qt.io/qt/
...
					

project variable name is used to form a file name for the index file; in this case the qtgui.index file is created. The url is stored in the index file. Afterwards, QDoc will use this as the base URL when constructing links to classes, functions, and other things listed in the index.

另请参阅 depends , indexes , project ,和 url .