Qt Jenny 安装
安装Qt Jenny :
快速入门方法
以QtJenny 演示为起点。它已经为一组 Android Java 类配置了代码生成项目,该代码生成项目已集成到 Qt C++ 应用程序主项目中。
专家方法和更详细的解释
- 你需要配置一个依赖于
qtjenny-annotation
和qtjenny-compiler
的 Gradle 项目。qtjenny-annotation 提供了一个注释处理器,qtjenny-compiler 提供了一个KAPT模块。Qt Jenny qtjenny-annotation 和 qtjenny-compiler 可以处理 Java 代码中的注解,而不是 Kotlin 代码,但这并不重要,因为注解并不针对生成项目本身的代码;注解只是为了触发封装生成已经定义并通过某些包可用的类,例如 Android SDK 提供的 Android API 类。
- 此外,代码生成还需要一套模板。Gradle 依赖项不会安装任何模板,因为这会把它们放在 Gradle 缓存目录下,而在那里编辑模板会很麻烦。并非所有用户都需要修改模板,但为了考虑到这种可能性,我们还是单独安装了模板。QtJenny Demo的代码生成子项目中安装了合适的模板。
- 完成这些步骤后,运行生成构建。之后,代码就已生成,并可供正常的 Qt C++ 项目使用。
如果 CMake 项目与QtJenny Demo 相同,则此步骤会在Qt C++ 项目的配置步骤中自动进行。
© 2025 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.