how to embed a image in the exe



  • I want to embed the image in my QT application but i dont want the image source to be placed with the exe . I tried with QRC in which i added the picture and i removed the source from the destination and i cleaned my project and builded it i was getting an error " :-1: error: [debug/qrc_resource.cpp] Error 1 " . how can we do this ?



  • @ManiRon how to add the resource image for the background image of the mainwindow



  • @ManiRon
    For your first post/question: read through https://doc.qt.io/qt-5/resources.html. That explains what your options are wrt supplying the image in a separate file (and where), or having Qt compile the image directly into the .exe so you don't have to supply an external file at all. Pick whichever appropriate approach you desire.



  • I often convert the image data to a large const array and build the image from the array. Of course it's extremely static at that point...and the size of the image itself and format need to be considered.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.