I have a widget with a transparent background.

setAttribute(Qt::WA_OpaquePaintEvent,true);
setPalette(QPalette(Qt::transparent));

I draw some stuff on the widget

QPainter p(this);
p.fillRect(0,0,10,10,Qt::black);

I would now like to erase the rectangle so that the area is once again transparent and the widgets underneath show through. I can't seem to figure out out to do this.

p.fillRect(0,0,10,10,Qt::transparent); doesn't work.

Any ideas?