Aragon
Aragon

Reputation: 193

How to draw single-colour Ellipse (no black border) with QPainter

Code for the beginning:

QColor yellow("#f0d048");
Qt::BrushStyle style = Qt::SolidPattern;
QBrush brush(yellow, style);
painter.setBrush(brush);
painter.drawEllipse(10,10,10,10);

Everytime I do this, I get a yellow circle surrounded by a black 1-pixel-sized border. In total the circle will have the same size like if I draw with black colour, so what shall I do to just get a single-coloured yellow circle without black border?

Best regards

Upvotes: 11

Views: 10232

Answers (1)

Thalia
Thalia

Reputation: 14615

Set a pen on painter

painter.setPen(Qt::NoPen);

Qt has 'brush' for filling figures, and 'pen' for drawing lines and outlines.

Upvotes: 24

Related Questions