Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Images from .qrc file aren't showing after relocating an executable in Windows
Forum Updated to NodeBB v4.3 + New Features

Images from .qrc file aren't showing after relocating an executable in Windows

Scheduled Pinned Locked Moved Solved Installation and Deployment
4 Posts 2 Posters 474 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    Sucharek
    wrote on last edited by Sucharek
    #1

    Hi, I have an issue with showing images from a resource file.
    When I relocate the file, add some .dll files, the images dissapear, and the theme is different.
    Example images:
    In Qt creator:
    0ef38cfc-69dd-4f4b-8850-f272fc4980d1-image.png
    Outside of Qt creator:
    39542b16-f4c2-4540-88e5-f0c6b97386a5-image.png
    Maybe it's deployment issues, but I don't know.
    My .pro file:

    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    CONFIG += c++11
    
    # You can make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
        additionalinfogetter.cpp \
        courses.cpp \
        keymappingscolor.cpp \
        main.cpp \
        mainwindow.cpp
    
    HEADERS += \
        additionalinfogetter.h \
        courses.h \
        keymappingscolor.h \
        mainwindow.h
    
    FORMS += \
        courses.ui \
        keymappingscolor.ui \
        mainwindow.ui
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    RESOURCES += \
        pictures.qrc
    

    My .qrc file:

    <RCC>
        <qresource prefix="/hands">
            <file>handRight.jpg</file>
            <file>handLeft.jpg</file>
        </qresource>
    </RCC>
    

    Note: This only happens in Windows.
    EDIT: Here are the contents of my folder:
    ATFinQt
    └──ATFinQt.exe
    └──libgcc_s_seh-1.dll
    └──libstdc++-6.dll
    └──libwinpthread-1.dll
    └──Qt5Core.dll
    └──Qt5Gui.dll
    └──Qt5Widgets.dll
    └──platforms
    ㅤㅤ└──qdirect2d.dll
    ㅤㅤ└──qminimal.dll
    ㅤㅤ└──qoffscreen.dll
    ㅤㅤ└──qwindows.dll

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You forgot the imageformats plugin subdirectory.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      S 2 Replies Last reply
      3
      • Christian EhrlicherC Christian Ehrlicher

        You forgot the imageformats plugin subdirectory.

        S Offline
        S Offline
        Sucharek
        wrote on last edited by Sucharek
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          You forgot the imageformats plugin subdirectory.

          S Offline
          S Offline
          Sucharek
          wrote on last edited by
          #4

          @Christian-Ehrlicher thanks, that worked.
          Also, copying the styles folder gave me the theme back.
          Thank you :D

          1 Reply Last reply
          0

          • Login

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