Qml network can't work on device?



  • Hi,everyone:
    A very simple qml file to prove that the qml network program can't work on device,but could run on pc.
    code:
    test.qml file:
    @import Qt 4.7

    Rectangle {
    width: 360
    height: 500

    Image {
        id: name
        source: "http://qt.nokia.com/logo.png"
    }
    

    }--@

    main.cpp
    @#include <QtGui/QApplication>

    #include <QDeclarativeView>
    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    QDeclarativeView view;
    view.setSource(QUrl("qrc:/main.qml"));
    view.show();
    return app.exec();
    }
    @

    test.pro

    @QT += core gui
    QT += declarative

    TARGET = testnetwork
    TEMPLATE = app

    SOURCES += main.cpp

    HEADERS +=

    RESOURCES +=
    test.qrc@

    test.qrc

    @<RCC>
    <qresource prefix="/">
    <file>main.qml</file>
    </qresource>
    </RCC>@

    If I run this code on Qt for Windows,qml will download the remote picture by itself,but on device it not work.
    I doubt there is a access point problem,but I can't find any information in qml assistant´╝č
    Any body could help me.



  • Did you verify that you have a working network connection at the device when you run the app? For instance by opening a browser on it?


  • Moderators

    What kind of device is it?

    If it is symbian you will need the networking capability set.



  • I use N8 device.

    when I launch the application,will use wlan or cmnet to connect network,but have no result.



  • Add NetworkServices Capability ,but not load the remote picture.BTW,my device could connect the internet correctly.



  • I heard there was an issue accessing "remote images" on the n900. Maybe it is not limited to it.



  • The above application example works fine on my N8, though you do need the NetworkServices capability if you're using Qt 4.7.1. From the upcoming Qt 4.7.2 onwards NetworkServices will be automatically appended to Symbian Qt applications that use declarative or webkit.

    Are you able to use networking on other Qt applications like weatherinfo demo? The demo can be found under Qt subdirectory demos\embedded\weatherinfo.



  • Thanks everyone.

    I study qml with rssnews demo in demos\declarative\rssnews example,and modify that project to Symbian c++ project,it could run and download the pictures and texts from remote server(yahoo server) on pc with Qt Creator IDE.But when I compile and make a sisx to install on N8,it could launch the app,but can't download pictures and texts.

    Because of that,I doubt something wrong with qml download remote resouces,so I did this simple test.Unfortionally,it has the same issuse with Rssnews demo.



  • @sujun.deng hi, i run into the same problem, did you get the solution?



  • Did you add networking capabilities for Symbian? You need to specify that explicitly.



  • Andre, i did add

    @TARGET.CAPABILITY = NetworkServices Location ReadUserData WriteUserData@

    But I can download files using QNAM, what i dont understand is that : what's the difference between QNAM and default QNAM for QDeclarativeEngine.

    You could find my thread having the similar problem "here":http://developer.qt.nokia.com/forums/viewthread/5639



  • ok, sorry, then I don't know.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.