Results 1 to 2 of 2

Thread: Transparent background on QLabel on transparent QWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Transparent background on QLabel on transparent QWidget

    Yes, I know. I read all of the threads which had to do with this, but I couldn't extract any information which could have been helpful to me.

    Here's what I need:
    I am trying to create a custom QWidget which doesn't use the default system frame, but instead its own. The frame is irregularly shaped, and I want to use setMask() to show only the opaque parts of the QWidget "Dialog". Now, everything is fine, the dialog is transparent as it should, but the images aren't. I have png images which use transparency and on the dialog, the system background shows up, which makes it not so transparent after all. I tried using:
    Qt Code:
    1. labelWithImage->setMask(QPixmap("/app/labelImage.png").mask());
    To copy to clipboard, switch view to plain text mode 
    but nothing happened. Then I tried setting the Qt::WA_NoSystemBackground, or Qt::WA_ContentsPropagated, but that resulted in weird results. I know this is possible because I saw some people do it in this thread. Look at the apple image on the first post. Yes it's ugly but how did they implement it? They just didn't include how to do it

    An example:
    As you can see, the background of the label isn't transparent. Now I have an image where the transparent pixels show up as that color. How would I solve this?
    Last edited by codeslicer; 13th February 2008 at 00:46. Reason: updated contents

Similar Threads

  1. Replies: 3
    Last Post: 8th December 2006, 19:51
  2. Replies: 1
    Last Post: 5th April 2006, 17:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.