Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. When running .exe on another computer, the image cannot be loaded from the resource file

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

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 185 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • zhmhZ Offline
    zhmhZ Offline
    zhmh
    wrote on last edited by
    #1

    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?

    J.HilkJ 1 Reply Last reply
    0
    • zhmhZ zhmh

      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?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

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

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


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      5

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved