I am trying to draw a polygon with multiple holes in them with QPainter (QT5.8, win64). I am using the following code:
QPainter pm(&image);
QPen p(Qt::gray, 2);
p.setCosmetic(true);
pm.setPen(p);
pm.setBrush(QBrush(color));
QPainterPath pap;
pap.addPolygon(pObject->getOuterGeometryPolyF());
for (int i = 0; i < (int)pObject->m_InnerGeometry.size(); i++)
{
QPainterPath papInner;
papInner.addPolygon(pObject->getInnerGeometryPolyF(i));
pap = pap.subtracted(papInner);
}
pm.drawPath(pap);
But it will only show one hole (see image):
Can someone provide me with an example of how to draw a polygon with multiple holes on it? The documentation is not clear on this point.