[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    How to make a transparent QLabel?
From:       Neil Stevens <neil () qualityassistant ! com>
Date:       2002-02-26 2:37:38
[Download RAW message or body]

Hi,

Whilst porting Jefferson ( http://www.freekde.org/neil/jefferson ) to KDE, 
I've run into a problem: QWidget::setAutoMask(true) doesn't appear to work 
the way it did under Qt 2, so I can't seem to make the QLabel transparent.

I read the docs and found that I have to reimplement updateMask for it to 
work, so I tried:

void KOSD::updateMask(void)
{
	QPixmap mask(size());
	QPainter painter(&mask);
	drawContents(&painter);
	painter.end();
	QBitmap bm = mask.createHeuristicMask();
	setMask(bm);
}

but the mask seems to get filled with random artifacts from the server.  
What am I doing wrong?  KOSD inherits QLabel, by the way, and in case it 
matters I have Flags set:

: QLabel(0L, "KOSD", WStyle_Customize | WStyle_StaysOnTop | 
WStyle_NoBorder )

and also set in the constructor:

KWin::setState( winId(), NET::Modal | NET::StaysOnTop | NET::SkipTaskbar | 
NET::SkipPager );


thanks,
-- 
Neil Stevens
neil@qualityassistant.com

Don't think of a bug as a problem.  Think of it as a call to action.
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic