简体   繁体   English

基于Qt,Qml和C ++的应用程序移植到Android

[英]Qt, Qml and C++ based application porting to Android

I am porting Qt(C++) and qml based app to Android platform. 我正在将Qt(C ++)和基于qml的应用移植到Android平台。 I am not using Qt Creator because of the nature of the project. 由于项目的性质,我没有使用Qt Creator

I have done compiling the code using ndk and generated all the required .so files for my C++ components. 我已经使用ndk编译了代码,并为我的C ++组件生成了所有必需的.so文件。 Created the project in Android studios, included the jiniLibs( *.so ) files, alos, used Qt provided Activity/Loader/Delegate classes and to write Android app. 在Android工作室中创建了项目,包括jiniLibs( *.so )文件,alos,使用Qt提供的Activity / Loader / Delegate类以及编写Android应用程序。 App loads the "main.so" and application get started. 应用程序加载“main.so”并启动应用程序。 I can see the logs which tells me that its loaded. 我可以看到日志告诉我它已加载。 I have created QGuiApplication object and while creating QmlComponent , I am trying to pass main.qml into QmlComponent instance within main.so but I don't know how to specify the path of main.qml ? 我创建QGuiApplication对象,并同时创造QmlComponent ,我试图通过main.qmlQmlComponent instancemain.so ,但我不知道如何指定的路径main.qml

I tried qrc:/main.qml , assets:/main.qml but no luck. 我试过qrc:/main.qml assets:/main.qml但没有运气。

NOTE: I placed my main.qml in assets folder. 注意:我将main.qml放在assets文件夹中。 I am not even sure when to put that file while packaging. 我甚至不确定何时在包装时放入该文件。

Looking for suggestion, how do we specify assets/resource paths inside C++ code. 寻找建议,我们如何在C ++代码中指定资产/资源路径。

// QQmlEngine* m_pQmlEngine;
m_pQmlEngine->setBaseUrl("qrc:/qml/");

Qt Android帮助程序类复制/data/data/org.qtproject.example.test/qt-reserved-files/路径中的所有资产,但您需要确保资产信息应映射到res/values/libs.xml中有一节

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM