Important: Please read the Qt Code of Conduct -

Can not load image on mobiledevice

  • I have a "resources.qrc" file with these content:

        <qresource prefix="/images">
            <file alias="fact.logo.png">Resources/Images/fact.logo.png</file>

    In my contructor I have implemented:


    In a function I have these code:

    QImage image(":/images/fact.logo.png");
        if (image.isNull())

    When I run it as a desktop app, everything is ok. But when it runs on my mobiledevice iphone6s the image can not be loaded.

    What can I do, to repair this?

  • Moderators

    I think you should rather include the resource in your .pro file.

    When you run Q_INIT_RESOURCE it means you are loading external resources - maybe Qt does not have access to them at the point where you are making the call?

  • @sierdzio Oh, sorry! I'm an absolutely newbe on qt. In my pro file it's also stated:

    RESOURCES += \

  • Moderators

    Then you don't need to run Q_INIT_RESOURCE(resources);, qmake already handles that for you.

    But it should work... hm. The only idea that comes to my mind now is that you can try changing the resource url from ":/images/fact.logo.png" to "qrc://images/fact.logo.png".

  • Yes, I've already tried that. But it does not help

Log in to reply