[Qt-interest] making QWidget transparent

David Boddie david.boddie at nokia.com
Tue Mar 3 19:28:16 CET 2009


Keshava Krishna wrote:

> is there any way to make widget transparent?
> 
> suppose for example
> if there is a QTextEdit over a QImage and QTextEdit is transparent, then
> the contents of QImage must be partially visible through QTextEdit...

Set the Base role of the QTextEdit's palette to Qt::transparent. Something
like this should work:

  QPalette palette;
  palette.setColor(QPalette::Base, QColor(red, green, blue, alpha));
  textEdit.setPalette(palette);

David
-- 
David Boddie
Senior Technical Writer
Nokia, Qt Software



More information about the Qt-interest-old mailing list