Important: Please read the Qt Code of Conduct -

[solved] QML app asks for internet connection on maemo device

  • Hi there,

    I wrote a small qml app which uses a XmlListModel filled via an xml in a qrc file. The app runs fine in the QtSimulator. When I deploy the app onto my maemo device (n900) and start it there, the device wants to open a internet connection. The whole app has no reference to the internet. The xml does not even reference a schema... any hints why that happens?

    As soon as I connect the device to the internet the applications runs fine.

    It seems to that somehow the QNetworkAccessManager makes the device think it needs an internet connection.

    I would appreciate any help!


  • It seems like a bug to me... I would try to reduce to smallest subset of code possible and if the error persists file as a bug

  • hm... looks like a bug to me too. Fill a "bug report": and post its number here, so we (and other guys in the future) can follow :-)

  • Wait, you're specifically using QNetworkAccessManager or you just mean that XmlListModel uses this?
    You have NETWORKACCESS / capability in your PRO file?
    And does it work in Simulator if you have turned off your internet? It may be requesting internet but finds it is already enabled in Simulator.

  • It's just the default QNetworkAccessManager that is used by the QDeclarativeEngine to do the transparent NetworkAccess. I do not use a special QNetworkAccessManager.
    In the .pro file Qt is configured like that:
    @QT += core gui declarative@

    Concerning the Simulator: What I already tried was switching off the internet connection on OS X. But even without the computer beeing connected to the internet the app worked well in the simulator.

    Do you mean turning off the internet in the simulator? I haven't tried this..thanks for the hint. I will check it tonight.

  • The cpp part of the app is really just a QMainWindow containing a QDeclarativeView as centralWidget. The rest is implemented in qml.
    So I tried to use the qmlviewer to display the qml files. To do that I did not use a qrc file containing the xml, but instead put the xml file into the qml directory. Which lead to:
    XmlListModel {
    id: model
    source: "foo.xml"
    instead of
    @ XmlListModel {
    id: model
    source: ":/foo.xml"

    Using this setup the application works in the qmlViewer and without the n900 asking for an internet connection. =)

    I will investigate more tonight.

  • Hi.

    Ok, i prepared a simple example using a ListView with a simple ListModel and another ListView with a XmlListModel.

    The behaviour is like that: In both cases the n900 asks for an internet connection. But only when using the simple ListModel, actual data is displayed.
    Using the XmlListModel results in

    1. the connection window popping up
    2. me, canceling the connection dialog
    3. the application does not display anything

    Using the simple ListModel:

    1. the connection window popping up
    2. me, canceling the connection dialog
    3. the application displays the data

    For the interested developer I pasted the sample code.
    ( I will most likely create a bug report soon, and put the link into this discussion then)

    @QT += core gui declarative

    CONFIG += mobility

    TARGET = networkTest
    TEMPLATE = app

    SOURCES += main.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui



    maemo5 {
    isEmpty(PREFIX):PREFIX = /usr/local
    BINDIR = $$PREFIX/bin
    DATADIR = $$PREFIX/share

    DEFINES += DATADIR=\\\"$$DATADIR\\\" \
    target.path = $$BINDIR
    INSTALLS += target


    @#include <QtGui/QApplication>
    #include "mainwindow.h"

    int main(int argc, char *argv[])
    QApplication a(argc, argv);
    MainWindow w;

    return a.exec&#40;&#41;;


    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>
    #include <QDeclarativeView>

    namespace Ui {
    class MainWindow;

    class MainWindow : public QMainWindow

    explicit MainWindow(QWidget *parent = 0);

    void changeEvent(QEvent *e);

    Ui::MainWindow *ui;

    QDeclarativeView *m_view;


    #endif // MAINWINDOW_H


    @#include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QDeclarativeEngine>
    #include <QDebug>

    MainWindow::MainWindow(QWidget *parent) :
    ui(new Ui::MainWindow)
    m_view = new QDeclarativeView;
    qDebug() << m_view->engine()->importPathList();

    delete ui;

    void MainWindow::changeEvent(QEvent *e)
    switch (e->type()) {
    case QEvent::LanguageChange:



    @import Qt 4.7

    Rectangle {
    id: container
    width: 800
    height: 480

    XmlListModel {
        id: model
        source: "test.xml"
        query: "//item"
        XmlRole { name: "name"; query: "name/string()" }
        XmlRole { name: "cost"; query: "cost/string()" }
    ListModel {
        id: fruitModel
             ListElement {
                 name: "Apple"
                 cost: 2.45
             ListElement {
                 name: "Orange"
                 cost: 3.25
             ListElement {
                 name: "Banana"
                 cost: 1.95

    // mainView: asks for connection as well,
    // but displays data without connection, too

    // ListView {
    // id: mainView
    // anchors.fill: parent
    // delegate: Text {text: name}
    // model: fruitModel
    // spacing: 5
    // anchors.margins: 5
    // }

    // mainView2 asks for internet connection and does not display any data
    // if there is no connection made
    ListView {
        id: mainView2
        anchors.fill: parent
        delegate: Text {text: name}
        model: model
        spacing: 5
        anchors.margins: 5


  • It looks more and more like a bug that will probable take the developer 5 minutes to find and fix but unfortunately will take a VERY long time to make into an official release... You may need to think about a workaround. Any reason not to copy the files to a folder and access them from there?

  • I created a bug report.
    I think I put it into the wrong category though: Qt Quick Components.
    ... was the only one with a reference to Qt Quick..

    Anyway: here is the "Bugreport":

  • Qt Quick Components is the official name of Qt-Components. The correct category for your bug is "Qt, component Declarative (QML) ":

  • [quote author="fcrochik" date="1291747656"] Any reason not to copy the files to a folder and access them from there? [/quote]
    Well, not really. I just like the convenience of the qrc files. You can edit them in the Creator. Then let QtCreator create the .deb package for deployment and that's it. No hassle with manually putting files into the debian folder of the build directory to get the files into place. =)

  • I agree... I am just concerned that you won't have a solution in a short time frame so you probably need a plan B.

    The one side effect of having the qml files on a folder is that you can allow people to "enhance" them ... of course that also means they can break them :)

    What I have done in the past was have the application on startup "extract" the files from the resources to a local folder if they didn't exist. This way if any problems happen the user can just delete the files from the local folder and the application will recreate them.

  • If any of the trolls is watching this thread: How can I move my "Bugreport": into the correct category ("Qt, component Declarative (QML) ": ?

  • You cannot move it yourself, the "edit issue" is disabled for us users. The only possibility I see is leaving a comment and/or creating a new issue in the right place.

  • The Trolls are pretty good on checking the bug reports and move them as necessary... More important than the group is the assigned resource and once this one sees something that is not his "expertise/responsibility" he will probably reassign.

    At least, that has been my experience...

  • Seems as if the category was already corrected: "Bugreport":

  • The bug report was closed, as the reported behaviour has already been fixed with commit 5120dfec47475dd37f51df4dda9a4ef8494036ab . Unfortunately this commit is not part of the maemo5 20.2010.36-2 package.

    See comment of Bea Leam in the "Bugreport":


  • Unfortunately that has been the issue with qt on maemo5. Because Qt is part of the "system" it can't be updated by itself.

    There has been some discussion on if distributing Qt will continue being Nokia responsibility or will be managed by the community. I don't know if the discussion went anywhere (or if it will) but it would be great to have the community manage it so we can have updates more often. If not, it may be worth making a little more flexible the rules about creating applications that depends on the qt-experimental packages.

Log in to reply