I'm trying to modify the painter method of QRubberBand to fit my taste of style, and for the most part it works just like it should, but I have tried to get the background to be invisible, but I have found no method that I had any luck with.

With no painting method for the background it is a transparent white.

Qt Code:
  1. class CustomRubberBand : public QRubberBand
  2. {
  3. public:
  4. CustomRubberBand(Shape s, QWidget * p = 0) : QRubberBand(s, p)
  5. {
  6. }
  7.  
  8. protected:
  9. void paintEvent(QPaintEvent *pe)
  10. {
  11. Q_UNUSED(pe);
  12.  
  13. QPainter painter;
  14. QPen pen(Qt::red, 6);
  15. pen.setStyle(Qt::SolidLine);
  16.  
  17. painter.begin(this);
  18. painter.setPen(pen);
  19. painter.drawRect(pe->rect());
  20. painter.end();
  21. }
  22. };
To copy to clipboard, switch view to plain text mode 



I've attached an example where you would be able to see what I'm talking about.
Does anyone know how to make it invisible?