When running .exe on another computer, the image cannot be loaded from the resource file



  • I added image to resource file:

    <RCC>
        <qresource prefix="/">
            <file>ring1.jpg</file>
            <file>pic1.jpg</file>
            <file>pic3.jpg</file>
            <file>Untitled.jpg</file>
            <file>Untitled2.jpg</file>
            <file>pic2.jpg</file>
            <file>pic4.jpg</file>
            <file>pic5.jpg</file>
            <file>ring2.jpg</file>
        </qresource>
    </RCC>
    

    And I change the background (of button,page 1,2 stackwidget,lineEdit,...)in the Design section
    For example :
    Right click on button > change style sheet > background-image: url(:/pic3.jpg);

    I run the code on my PC from the QT creator or .exe and that's right
    I added the required .dlls to run .exe(libgcc_s_dw2-1.dll,libstdc++-6.dll,libwinpthread-1.dll,Qt5Core.dll,Qt5Cored.dll,Qt5Gui.dll,Qt5Guid.dll,Qt5widgets.dll,Qt5widgetsd.dll,platforms Folder)
    But when I run .exe on another computer that doesn't have QT installed, the images don't Load and don't show up
    Where is the problem?
    resource file has .dll that I should add it?


  • Moderators

    hi @zhmh
    you did not run the windeployqt tool, right?

    otherwise you would have a imageformats folder with a qjpeg.dll file in it


 

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