【问题标题】:QML loading , file not foundQML 加载,找不到文件
【发布时间】:2012-02-11 19:10:11
【问题描述】:

我正在为 Android 开发应用程序。作为一些成员 建议使用 QML 进行 gui 设计我遇到了这个问题。 当我在桌面上加载应用程序时,一切都很顺利。但问题是什么时候 将其移植到 Andorid 上。 这是我的错误:

`W/Qt      ( 1819): file:///data/data/org.kde.necessitas.example.Imenik/files/gui.qml:` 
File not found

我启动 QML 的代码是:

QDeclarativeView view; 
     view.setSource(QUrl::fromLocalFile("gui.qml")); 
     view.show(); 

这是我的专业档案:

SOURCES += main.cpp mainwindow.cpp 
HEADERS += mainwindow.h 
FORMS += mainwindow.ui 
QT += \ 
      network \ 
      xml \ 
      declarative 

我真的不知道问题可能出在哪里。我试过将它作为桌面应用程序运行,一切正常。但不能移植到安卓上。

【问题讨论】:

    标签: android c++ qt qml


    【解决方案1】:

    可能你的 QML 文件没有部署在手机上。

    添加类似的东西

    QML_FILES.source = qml
    QML_FILES.target = .
    DEPLOYMENTFOLDERS += QML_FILES
    
    # Please do not modify the following two lines. Required for deployment.
    include(qmlapplicationviewer/qmlapplicationviewer.pri)
    qtcAddDeployment()
    

    到您的 .pro 文件。确保最后两行位于末尾。这适用于 Symbian 和 Harmattan,也许 Necessitas 的部署有点不同。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-13
      • 1970-01-01
      相关资源
      最近更新 更多