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.