qul_target_generate_interfaces

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

概要

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

描述

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.

选项

可以设置 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.

可选 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.

范例

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.

另请参阅 集成 C++ 代码采用 QML .