Merge pull request #221 from rabryan/finite-fills

support multiple polygon paths in FillBetweenItem
This commit is contained in:
Luke Campagnola 2015-12-20 21:09:35 -08:00
commit 9796a3fd10

View File

@ -70,11 +70,14 @@ class FillBetweenItem(QtGui.QGraphicsPathItem):
path = QtGui.QPainterPath()
transform = QtGui.QTransform()
p1 = paths[0].toSubpathPolygons(transform)
p2 = paths[1].toReversed().toSubpathPolygons(transform)
if len(p1) == 0 or len(p2) == 0:
ps1 = paths[0].toSubpathPolygons(transform)
ps2 = paths[1].toReversed().toSubpathPolygons(transform)
ps2.reverse()
if len(ps1) == 0 or len(ps2) == 0:
self.setPath(QtGui.QPainterPath())
return
path.addPolygon(p1[0] + p2[0])
for p1, p2 in zip(ps1, ps2):
path.addPolygon(p1 + p2)
self.setPath(path)