[英]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. 每次我这样做,我得到一个黄色圆圈,周围是黑色的1像素大小的边框。 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 最好的祝福
Set a pen on painter 在画家上画笔
painter.setPen(Qt::NoPen);
Qt has 'brush' for filling figures, and 'pen' for drawing lines and outlines. Qt已经“刷”填充数字,“笔”用于绘制线条和轮廓。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.