Hi Everybody,

I try to change the opacity in QLabel.
Using the paintEvent with this kind of code:

Qt Code:
  1. void myLabel::paintEvent(QPaintEvent * e)
  2. {
  3.  
  4. QPainter p(this);
  5.  
  6. // if pixmap
  7. if (! pixmap()->isNull())
  8. p.drawPixmap(pixmap()->rect(), * pixmap());
  9.  
  10. p.setOpacity(0.5);
  11.  
  12. // if Text
  13. if (! text().isEmpty())
  14. p.drawText(rect(), text());
  15.  
  16. }
To copy to clipboard, switch view to plain text mode 

The aim is just to change the opacity level ; The problem with this code is that , I have to redraw everything manually : style , pixmap position, text position...
it's not so easy...

If someone has something more easy, it will be fine

Thanks to all

David