QML Documentation Example

This example demonstrates one of the ways to document QML types.

In particular, there are sample types that are documented with QDoc commands comments. There are documentation comments for the QML types and their public interfaces. The types are grouped into a module, the UI 组件 模块。

The uicomponents.qdoc file generates the overview page for the UI 组件 模块页面。

The generated documentation is available in the UI 组件 模块。

QML Class

The QML types use the \qmltype to document the type. In addition, they have the \inmodule command in order for QDoc to associate them to the UIComponents 模块。

QDoc uses the \brief command to place a basic description when listing the types.

Properties, Signals, Handlers, and Methods

The types have their properties, signals, handlers, and methods defined in their respective QML files. QDoc associates the properties and methods to the types, therefore, you only need to place the documentation above the property, method, or signal.

To document the type of a property alias , you must use the \qmlproperty command to specify the data type.

\qmlproperty int anAliasedProperty
An aliased property of type int.
					

Internal Documentation

You may declare that a documentation is for internal use by placing the \internal command after the beginning QDoc comment /* . QDoc will prevent the internal documentation from appearing in the public API.

If you wish to omit certain parts of the documentation, you may use the \omit and \endomit 命令。

QML Types with C++ Implementation

This example only demonstrates the documentation for types in QML files, but the regular QML commands may be placed inside C++ classes to define the public API of the QML type.

文件: