[Qt-interest] How to fill QLabel Circles with different color
Arun
arun_kumar at denso-diam.com
Wed Jan 7 20:36:33 CET 2009
Normally what we will do to fill the color in widget with
paintEvent is by using setPen & setBrush, as shown below.
void paintEvent(QPaintEvent *event)
{
QPainter p(this);
p.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap));
p.setBrush(QBrush(Qt::black, Qt::SolidPattern));
p.drawEllipse(0, 0, width() - 1, height() - 1);
p.end();
QLabel:aintEvent(event);
}
Here in the above shown example I am filling all the circles with black color.
But my problem is I have to fill the each circle with
random/differnt colors taken from some other functionality.
I cannot pass that color into this paintEvent function.
So I have to do some other things which fills different
colors for these circles.
So how to fill solid pattern colors for these
different paintEvent drawn circles ?
Thanks
More information about the Qt-interest-old
mailing list