Qt 5.9 | QDoc Manual | QML Documentation Example

Qt 5.9.2 Reference Documentation

# 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 Components module.

The uicomponents.qdoc file generates the overview page for the UI Components module page.

The generated documentation is available in the UI Components module.

## 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` module.

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

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

Files:

- componentset/ProgressBar.qml
- componentset/Switch.qml
- componentset/TabWidget.qml
- componentset/uicomponents.qdoc.sample
- componentset/componentset.pro