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. Can't display images in Qt
Qt 6.11 is out! See what's new in the release blog

Can't display images in Qt

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 1.0k 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.
  • M Offline
    M Offline
    MasterBlade
    wrote on last edited by
    #1

    I am using Qt on Windows 10 x64 with MSVC 2017. I compiled the code and moved the exe file (and others) to another PC. That PC is using Windows 7 x64.

    I found that the layout looked different and, to make things worse, the images are not displaying.
    I stored all the images under /images/ of that exe file and used QDir::currentPath() + "/images/" + cardid + ".jpg"; to load the image. It worked alright on my computer. But it doesn't display on that Windows 7 PC.

    Any suggestions on how to solve it?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      TobbY
      wrote on last edited by
      #2

      Hi,
      Have you added imageformats (Contains image extensions) and platform plugin dir in executable directory.

      1 Reply Last reply
      4
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        Added error handling so u know if it doesn't find the image or what is wrong.

        Also, use deployment tool so u don't miss any image plugins.
        http://doc.qt.io/qt-5/windows-deployment.html
        http://www.tripleboot.org/?p=138

        for some formats it might need extra folder and dll(s)

        1 Reply Last reply
        5
        • M Offline
          M Offline
          MasterBlade
          wrote on last edited by
          #4

          Problem solved. Thanks for the help!

          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