Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Externl images are not visible when running the application
Qt 6.11 is out! See what's new in the release blog

Externl images are not visible when running the application

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 865 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.
  • C Offline
    C Offline
    coldspark29
    wrote on last edited by
    #1

    I have already searched online and the solution I found did not solve my issue. I have created a QtQuick application and am editing my main.qml file in qml.qrc with Qt Design Studio. The image is visible in the Design tab, but when I run the app, I cannot see it. I have already tried running qmake and since I set it as the build system, this should happen automatically.

    Here is a picture of my folder structure

    cecfb020-c6a4-4c36-a62c-31eff6611d08-grafik.png

    Please let me know what other settings or code snippets you need to narrow down the root of this problem!

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      How do you reference those images? Hopefully not relative paths since then the location depends on the current working dir. Better use e.g. QCoreApplication::applicationDirPath() or put them into a resource file.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • C Offline
        C Offline
        coldspark29
        wrote on last edited by
        #3

        @Christian-Ehrlicher I have just added them to my assets and dragged them into the formulary editor. They are in relative paths. Isn't there a way to hard-bake them into the executable? The goal is to ultimately cross-compile this for the Raspberry Pi.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @coldspark29 said in Externl images are not visible when running the application:

          Isn't there a way to hard-bake them into the executable?
          The goal is to ultimately cross-compile this for the Raspberry Pi.

          This somehow contradicts each other, or?
          How should a hard-coded absolute path help?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • C Offline
            C Offline
            coldspark29
            wrote on last edited by coldspark29
            #5

            No, I meant that the images are part of the executable. Don't know if that is possible at all. Should I use absolute or relative paths now? I'd rather use relative ones, but actually both don't work. It always says it can't find the image, although it is there.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              coldspark29
              wrote on last edited by
              #6

              Ah, I deleted the files from the folder and added the assets again. This time it worked. Weird that it didn't last time. Thanks for the help though!

              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