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.