Draw a filled circle

I wrote a function that should draw a filled black circle on my chart. Function draws a black aligned circle, but not filled? This is my function:

void World::damage(int x, int y) { QPainter painter(&worldImage); painter.setBrush(QBrush(Qt::black)); painter.drawArc(x,y,150,50,0,16*360); item = new QGraphicsPixmapItem(QPixmap::fromImage(worldImage)); this->addItem(item); } 

Yours faithfully,

+7
source share
2 answers

drawArc() does not use fill color, use drawEllipse() for a filled full circle.

+10
source

drawEllipse() alone did not solve my problem

I just added painter.setBrush(Qt::red);

before drawEllipse()

and works great.

+4
source

All Articles