codeslicer
12th February 2008, 23:38
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() (http://doc.trolltech.com/latest/setmask%28%29.html) 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:
labelWithImage->setMask(QPixmap("/app/labelImage.png").mask());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 (http://www.qtcentre.org/forum/f-qt-programming-2/t-ugly-move-with-a-top-level-setmasked-widget-10825.html). 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 :(
http://www.qtcentre.org/forum/attachment.php?attachmentid=480&d=1153221757
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?
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() (http://doc.trolltech.com/latest/setmask%28%29.html) 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:
labelWithImage->setMask(QPixmap("/app/labelImage.png").mask());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 (http://www.qtcentre.org/forum/f-qt-programming-2/t-ugly-move-with-a-top-level-setmasked-widget-10825.html). 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 :(
http://www.qtcentre.org/forum/attachment.php?attachmentid=480&d=1153221757
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?