QML images not loading in ui file

Viewed 91

I have created a QML file which is a speedometer. This file includes several .png images which I have provided the path in QML file and it works fine. But is there any possible way to embed these images permanently? As I want to use this QML in a QT C++ UI file using QQuickWidget which only loads the QML file without images.

1 Answers
For getting images we have to add resource file to project.Follow below steps to add images to the
Resource file.
1.Right click on resources in project>>add new>>Qt>>Qt Resource File>>choose
2.Location-name>>next>>finish
3.add prefix>>prefix-/img
4.Add files>>image.png
5.Build. Images will be added to resource.
Images are added to the Resource file

PFA


  [1]: https://i.stack.imgur.com/vhQK0.png
Related