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. Transparent Image not displaying correctly in QLabel
Forum Updated to NodeBB v4.3 + New Features

Transparent Image not displaying correctly in QLabel

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 855 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.
  • DriftwoodD Offline
    DriftwoodD Offline
    Driftwood
    wrote on last edited by
    #1

    I placed a transparent image inside a QLabel:

    Screenshot from 2021-08-27 10-21-02.png

    And when I run my app, I get this:

    Screenshot from 2021-08-27 10-28-31.png

    Do transparent images not work in QLabels? If not, is there another mechanism/object that facilitates this?

    raven-worxR 1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      yourlabel->setAutoFillBackground(false);

      DriftwoodD 1 Reply Last reply
      1
      • DriftwoodD Driftwood

        I placed a transparent image inside a QLabel:

        Screenshot from 2021-08-27 10-21-02.png

        And when I run my app, I get this:

        Screenshot from 2021-08-27 10-28-31.png

        Do transparent images not work in QLabels? If not, is there another mechanism/object that facilitates this?

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        @Driftwood
        are you sure your image is transparent?
        to me your example rather looks like the image contains the checker pattern and no transparency
        (Qt doesnt draw a checker pattern)

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        DriftwoodD 1 Reply Last reply
        1
        • JoeCFDJ JoeCFD

          yourlabel->setAutoFillBackground(false);

          DriftwoodD Offline
          DriftwoodD Offline
          Driftwood
          wrote on last edited by
          #4

          @JoeCFD

          Setting that to True or False bears the same result. I've done all I know, including using other transparent images, and I can't get...wait! I just got one to work. Now if I can only remember what I did to make that happen :D

          Just kidding. I got an image that loses the transparent background, the checkered area.

          Screenshot from 2021-08-27 13-38-44.png

          Thanks again for your help, JoeCFD.

          1 Reply Last reply
          0
          • raven-worxR raven-worx

            @Driftwood
            are you sure your image is transparent?
            to me your example rather looks like the image contains the checker pattern and no transparency
            (Qt doesnt draw a checker pattern)

            DriftwoodD Offline
            DriftwoodD Offline
            Driftwood
            wrote on last edited by Driftwood
            #5

            @raven-worx

            The checkered background, aside from other things, signifies image area that's transparent. By all rights, it shld vanish completely and allow the app bg color to fill in. I can only guess that some of the stock images were incorrectly created as being why I had trouble. But the last one, shown above, worked as expected. Thanks for your input. That's what got me thinking abt the legitimacy of the image's transparency.

            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