Externl images are not visible when running the application
-
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
Please let me know what other settings or code snippets you need to narrow down the root of this problem!
-
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.
-
@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.
-
@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? -
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.
-
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!