Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Can not load image on mobiledevice

Can not load image on mobiledevice

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 2 Posters 1.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.
  • P Offline
    P Offline
    peter-70
    wrote on last edited by peter-70
    #1

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

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

    In my contructor I have implemented:

    Q_INIT_RESOURCE(resources);
    

    In a function I have these code:

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

    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?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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?

      (Z(:^

      P 1 Reply Last reply
      0
      • sierdzioS sierdzio

        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?

        P Offline
        P Offline
        peter-70
        wrote on last edited by
        #3

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

        RESOURCES += \
            resources.qrc
        
        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          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".

          (Z(:^

          1 Reply Last reply
          1
          • P Offline
            P Offline
            peter-70
            wrote on last edited by
            #5

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

            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