I written a code in QT(4.5) to draw or paint a circle on parent widget.
The code is like this.
void frmdemo:aintEvent (QPaintEvent *)
{
QPainter paint(this);
paint.setPen(red);
paint.setBrush(Qt::green);
paint.drawEllipse(10, 400, 25, 25);
}
The above code will paint a circle on parent widget.
But if i want to draw a circle on tabwidget, ie on child widget because tabwidget is lies on parent widget. The code is like this.
void frmdemo:aintEvent (QPaintEvent *)
{
QPainter paint(tabplot);
paint.setPen(red);
paint.setBrush(Qt::green);
paint.drawEllipse(10, 400, 25, 25);
}
The above code will not paint a circle on tabwidget named as tabplot. This code will work in qt3.1, but not in qt4.5.
After executing the pgm, the message will come in terminal window as widget painting only begin as a paintevent.
how to paint a circle on child widget. please suggest me.

aintEvent (QPaintEvent *)
Reply With Quote

