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. QLabel pixmap does not display
Forum Updated to NodeBB v4.3 + New Features

QLabel pixmap does not display

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 9.6k 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.
  • T Offline
    T Offline
    trigga_gnome
    wrote on last edited by
    #1

    Hello, I am trying to display an image to indicated whether a field is valid or invalid. To do this I am attempting to use a QLabel displaying an appropriate image. I have set the gui up in designer and set the pixmap property of the QLabel to an image indicating an invalid entry. When I preview the gui, everything looks good but when I compile and run the application, the image in the QLabel does not display. The image is a png. Any ideas?

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

      Once I had the similar problem. The image had an error on the header. After I opened and saved it again with the photoshop, it worked..

      Computer Scientist
      Belo Horizonte - Brasil
      C++ Development
      Qt Development

      1 Reply Last reply
      0
      • T Offline
        T Offline
        trigga_gnome
        wrote on last edited by
        #3

        ah, tried that, no dice... Thanks anyways. I also tried using a bmp with no success.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          task_struct
          wrote on last edited by
          #4

          Are you using full or relative path to image? When you preview the GUI, it is executed from one directory, but when you compile the project, it is executed from another directory.

          "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

          • Linu...
          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Probably best to include the image in a resource, and compile it into your application. Prefer to use a .png file, as that format is always compiled in in Qt, saving you redistribution issues with image plugins. You can then directly select the image from the resource file in Designer.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              trigga_gnome
              wrote on last edited by
              #6

              Thanks everyone. I had created a resource file with the images I'm using but I forgot to put the RESOURCES entry in my project file. Looks good now. Thanks again! :)

              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