1

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

asked Feb 19, 2021 at 15:45

1 Answer 1

1

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">
<qresource>
 <file>images/b2.png</file>
</qresource>
 </RCC>

the image b2.png is under test_v1/images

answered Feb 23, 2021 at 10:20

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.