I'm subclassing QProgressBar in a custom widget, and I overwrote the paintEvent method with the following code :
void myProg::paintEvent(QPaintEvent *pe)
{
QProgressBar::paintEvent(pe);
QRect region = pe->rect();
QPainter *painter = new QPainter(this);
QPen *pen = new QPen;
painter->begin(this);
painter->setBrush(Qt::red);
int x = this->x();
int y = this->y();
pen->setWidth(10);
painter->setPen(*pen);
painter->drawLine(x,y,x+100,y);
painter->end();
}
I'm trying to display a red line, as a starting point, to see that I can add my own modifications to the widget. However, this isn't working. I only see the widget as a regular QProgressBar. Any ideas on what could be wrong ?