Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Project doesn't work on device when using Resource file
QtWS25 Last Chance

Project doesn't work on device when using Resource file

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    uruselfei
    wrote on last edited by
    #1

    hello,

    I have a QML project which uses couple Qt modules (to handle network and location). Project is ready for deployment and now it is time to make it work with resource file. project name is similar to "MyProject" (uses capital letters in project name).

    DEPLOYMENTFOLDERS is commented out in .pro file and source (in main.cpp) is set to QRC: viewer->setSource(QUrl("qrc:/qml/MyProject/main.qml"));

    .qrc file is created and works perfectly in simulator.

    now, when i try to run my project on Harmattan device, I got errors related to Qt modules:
    @qrc:/qml/MyProject/screens/PageSplash.qml:58: ReferenceError: Can't find variable: networking
    qrc:/qml/MyProject/screens/PageSplash.qml:61: ReferenceError: Can't find variable: networking@

    Question: what should i check to be sure that i prepared everything to use resource file and what might cause errors on device if everything is OK in simulator?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      srikanth_trulyit
      wrote on last edited by
      #2

      As per the error message PageSplash.qml is successfully loaded from resource file, as it is able to parse it and report a reference error. The error has something to do with your qml code. It would be more helpful if you can paste some code where your are using variable "networking".

      1 Reply Last reply
      0
      • U Offline
        U Offline
        uruselfei
        wrote on last edited by
        #3

        PageSplash.qml:

        @ Component.onCompleted: {
        // Page element completed
        networking.getTime()
        }
        Connections {
        target: networking
        onAccountInfoRecieved:{
        networking.getUpdatesInfo(true);
        }
        }@

        Networking is defined in main.cpp as:

        @#include <networking/networking.h>
        ...
        networking networkHandler;
        QDeclarativeContext *ctxt = viewer->rootContext();
        ctxt->setContextProperty("networking", &networkHandler);@

        1 Reply Last reply
        0
        • S Offline
          S Offline
          srikanth_trulyit
          wrote on last edited by
          #4

          Looks like networking context property is not set properly. I set context properties before using setSource() on viewer, I remember some issue with when used after setSource(). To be sure that networking is set properly or not print it in console.

          1 Reply Last reply
          0
          • U Offline
            U Offline
            uruselfei
            wrote on last edited by
            #5

            networking is set before setSource().

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved