I cross compiled Qt5.14.2 for my raspberry pi 4 on a raspberry pi OS lite

after that I created a Qt Quick application on my Ubuntu and I integrated images in my qml file

Image {
        id: compteur
        x: 223
        y: 102
        width: 570
        height: 227
        source: "images/b2.png"

so the image b2.png on my ubuntu is under ~/Desktop/test_v1/images and the executable test_v1 was generated under ~/Desktop/build-test_v1-Qt5pi-Release

on my raspberry pi I copied this executable and copied also all the directory test_v1

but when executing the application it worked well but the images didn't show up

I tried also to put the images and the executable in the same directory but couldn't work also.

if you know what should I change please tell me !

Thank you in advance


I found the solution and it may help someone so I am going to post it.

I used Qt resources https://doc.qt.io/qt-5/resources.html and it will help you to integrate the images to the executable.

so under my test_v1 directory I created a file image.qrc (I used nano to create it) after that in qtcreator I added to my project this file (right click on the project -> add existing files-> choose image.qrc)

image.qrc containes :

<!DOCTYPE RCC> <RCC version="1.0">

the image b2.png is under test_v1/images

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.