QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS
启用基于 QtQuickViewContent 的类生成功能。
该变量自 Qt 6.8 起引入。
注意:该 变量目前处于技术预览阶段,未来版本中可能会发生变化。
注意:此 变量仅在针对 Android 平台时使用。
将其设置为TRUE ,可为目标应用程序的QML组件启用Java代码生成。生成的代码将包含在最终生成的包中。 生成的类的 Java 包名将与 Android 应用程序包名相同。如果包名的末尾部分与目标可执行文件不一致,则会生成一个额外的静态类(其名称与大写形式的目标可执行文件名称相同),该类将包裹所有包含 Java 类的 QML 模块。 每个 QML 模块类(同样采用首字母大写的形式)将包含QtQuickViewContent扩展类,这些类代表该模块的 QML 组件。
set(QT_ANDROID_GENERATE_JAVA_QTQUICKVIEW_CONTENTS TRUE)
set_source_files_properties(MyView.qml PROPERTIES QT_QML_GENERATE_ANDROID_JAVA_CLASS TRUE)
qt_add_qml_module(myapp URI MyModule QML_FILES MyView.qml)© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.