Hi all,
I know there's a lot of stuff on transparency, but I haven't quite found what I'm looking for.
I've a QLabel. I'd like the baskground to be transparent - that is, it should appear as text 'on the desktop'
this is what I'm doing:
{
QPalette p
(palette
());
//get the widget's default palette p.
setColor ( QPalette::WindowText, Qt
::darkGreen );
setPalette(p);
}
void LabelBase
::update (const QString text
) {
setText(text);
setPixmap(pixmap);
theMask = pixmap.createHeuristicMask(false);
//theMask = createMaskFromColor(Qt::darkGreen);
setMask(theMask);
}
LabelBase(QWidget *parent): QLabel(parent)
{
QPalette p(palette());//get the widget's default palette
p.setColor ( QPalette::WindowText, Qt::darkGreen );
setPalette(p);
}
void LabelBase::update (const QString text)
{
setText(text);
QWidget::setFixedSize(QLabel::sizeHint());
QPixmap pixmap = QPixmap::grabWidget ( this );
setPixmap(pixmap);
theMask = pixmap.createHeuristicMask(false);
//theMask = createMaskFromColor(Qt::darkGreen);
setMask(theMask);
}
To copy to clipboard, switch view to plain text mode
(theMask, above, is a QRegion)
The problem that I can't seem to make a good mask from the text. createHeuristicMask() leaves unmasked 'holes' in the text (the character 'o' is filled, for instance), and createMaskFromColor() doesn't seem to do anything for me. examples are attached.
So, the question, how can I best make a mask for my text.
thanks
K
Bookmarks