C

qul_target_generate_interfaces

Exposes the exported C++ classes to the QML context.

Synopsis

qul_target_generate_interfaces(<target> src_file1 [src_file2 ...]
                               [OUTPUT_DIRECTORY <directory>]
                               [QML_IMPORTS <uri1> [<uri2> ...])

Description

Creates rules to run the qmlinterfacegenerator tool over the given C++ files as part of the target. This produces QML interface files that are placed in a subfolder under the build directory. These files enables you to use parts of the C++ types in QML.

Options

You can set the OUTPUT_DIRECTORY variable explicitly, to control where the generated files are placed. If the path is relative, it is relative to the current build directory.

The optional QML_IMPORTS option adds imports to the generated QML files. These imports are necessary if any of the used C++ types are exposed in another QML module. The uris are normal dot-separated QML import uris.

Examples

qul_target_generate_interfaces(example_app gamemodel.h)
qul_target_generate_interfaces(example_app myindicatorstyle.h
                               QML_IMPORTS MyModules.Indicators
                               OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

Since

This command was introduced in Qt Quick Ultralite 1.0.

See also Integrating C++ code with QML.

Available under certain Qt licenses.
Find out more.