Strange problem with Qt resource system (qrc)



  • Hello everyone,

    For several days I've been struggling with a serious problem with a QML application I've recently created.

    If I make it 'normally', i.e. with all qml, js, graphics etc. files installed separately, without packaging them into a resource (qrc) then everything works fine.

    But if I pack all files into a resource (.qrc) so that one executable is produced, bizarre things are happening.... The application installs and initially runs just perfectly, but after some time it suddenly fails to enable the positioningSource. And when it fails to do it one time, it is for good, i.e. it stops being able to enable the positioning source ever again...

    I don't know how to best describe it, but after I install it, initially it normally enables the positioning source on start - the GPS icon appears, flashes as it gets the fix, then the application normally gets the coordinates, etc. But after several launches of the application, the GPS just suddenly stops activating itself - no GPS icon appears, the application is waiting for positioning data eternally and never gets them... And at that point NOTHING can be done to solve the problem - the GPS just won't activate itself no matter what. Reinstalling the application (in the same version using the QRC resource) doesn't help, rebooting the device doesn't help.

    But if I reinstall the application in a version without using the Qt resource system, i.e. with all files stored locally/separately (or actually with the binary still having all the files in the resource, but with the qml folder with 'standalone' files also installed), the positioning source instantly starts working again and it never stops working.... No changes in the code whatsoever, not a single file being modified, the only difference being making the qml folder also installed, i.e. just uncommenting the DEPLOYMENTFOLDERS option in the .pro file...

    Oh, and what's even more strange, if I install the version with the qml folder (with the files still in the resource, but additionally also in qml folder locally) which makes the GPS work again, and then I replace it with the version using just the resource (with just the single executable) then the GPS continues to work initially, and after some time it stops activating....

    Please note that the problem with launching the positioning source is the ONLY issue that happens when the files are packed into the resource. Everything else works fine. So it does not look like a problem with incorrect paths to files or something like that. The positioning source is being activated in the main qml file which loads fine also after the GPS stops working. Every qml, js, image file in the resource is normally accessible, nothing else is broken, it's JUST that the GPS stops working. And, what's worse, it stops working only AFTER SOME TIME (after several launches of the application) - initially it does work OK, too...

    Does anyone have any ideas before I experience a mental breakdown?

    P.S. Tested and behaving the same way on both N950 PR1.2 and N9 PR1.1



  • Nevermind, I helped myself.

    As it doesn't want to correctly work from within the resourced QML, instead of further wasting time on trying to find what's causign it, I simply launch the position source from the main.cpp and this way it always works.

    Cheers.


Log in to reply
 

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