Why the background is not transparent?
Hi, I use the following code to obtain a window with the shape of the pixmap "tux.png". The problem is that the background is painted in black color. Where's the mistake? Thanks.
Code:
#include <QtGui>
int main( int argc, char **argv )
{
if (p.mask().isNull())
{
if ( img.hasAlphaChannel() )
p.
setMask(QBitmap::fromImage(img.
createAlphaMask()));
else
p.
setMask( QBitmap::fromImage(img.
createHeuristicMask()));
}
QWidget w
(0, Qt
::FramelessWindowHint);
w.setPalette(palette);
w.setFixedSize(p.size() );
w.setMask(p.mask());
w.show();
return a.exec();
}
Re: Why the background is not transparent?
Sorry it's solved with the current version :rolleyes:
Re: Why the background is not transparent?
Can you verify if it is the createHeuristicMask() or the createAlphaMask() that is not working or is it both? Try commenting each out to see where the problem lies.
Then we can take it from there.
Edit: Oops, just saw your latest post. Ignore this.
Re: Why the background is not transparent?
Yes sorry Chicken Blood Machine, I think that the problem was that I was not drawing the pixmap p in the first version...
Re: Why the background is not transparent?
I'm sorry... how did you get the background transparent? I've been having this same issue.