简体   繁体   中英

QPainterPath stroke artifacts

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? 例

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM