c++qtqpainterdrawellipse

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


Solution

  • Set a pen on painter

    painter.setPen(Qt::NoPen);
    

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