0

I am putting together a QPainterPath with text, then I'm drawing it, first with QPainter::strokePath, then with QPainter::fillPath. However, the stroke exhibits artefacts, as shown in the image. Anything I am doing wrong/how to prevent this? Should I report it as a bug? Example

Danol
  • 368
  • 1
  • 15

1 Answers1

0

I've found out that instead of using strokePath and fillPath, the following code works without artefacts and is even faster to render:

if(outlineEnabled) {
    p.setBrush(Qt::NoBrush);
    p.setPen(QPen(outlineColor, outlineWidth/scaleFactor, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
    for(const auto &polygon : path.toSubpathPolygons())
        p.drawPolygon(polygon, Qt::OddEvenFill);
}

p.setBrush(color);
p.setPen(Qt::NoPen);
for(const auto &polygon : path.toFillPolygons())
    p.drawPolygon(polygon, Qt::OddEvenFill);
Danol
  • 368
  • 1
  • 15