Hi,

I'm trying to developp a text widget with a transparent background. I subclass the QLabel class and reimplements its drawContents function in which I only draw the text as follow :
Qt Code:
  1. void CText::drawContents(QPainter* painter)
  2. {
  3. painter->drawText(0, 0, this->text());
  4. }
To copy to clipboard, switch view to plain text mode 

... but the gray background still appears.

The documentation says about this function :
Qt Code:
  1. Draws the label contents using the painter p.
  2. Reimplemented from QFrame.
To copy to clipboard, switch view to plain text mode 
so I thought maybe the paintEvent handler in a base class does something special as drawing the background, that's why I decided to reimplement the paintEvent handler with the following code :
Qt Code:
  1. void CText::paintEvent(QPaintEvent* event)
  2. {
  3. QPainter* painter = new QPainter(this);
  4. painter->drawText(10, 10, this->text());
  5. }
To copy to clipboard, switch view to plain text mode 
... it still draws the background

Isn't it possible to just display the text without any background (i.e. with a transparent background) ?

Thanks in advance.