Merge pull request #221 from rabryan/finite-fills
support multiple polygon paths in FillBetweenItem
This commit is contained in:
commit
9796a3fd10
@ -70,11 +70,14 @@ class FillBetweenItem(QtGui.QGraphicsPathItem):
|
|||||||
|
|
||||||
path = QtGui.QPainterPath()
|
path = QtGui.QPainterPath()
|
||||||
transform = QtGui.QTransform()
|
transform = QtGui.QTransform()
|
||||||
p1 = paths[0].toSubpathPolygons(transform)
|
ps1 = paths[0].toSubpathPolygons(transform)
|
||||||
p2 = paths[1].toReversed().toSubpathPolygons(transform)
|
ps2 = paths[1].toReversed().toSubpathPolygons(transform)
|
||||||
if len(p1) == 0 or len(p2) == 0:
|
ps2.reverse()
|
||||||
|
if len(ps1) == 0 or len(ps2) == 0:
|
||||||
self.setPath(QtGui.QPainterPath())
|
self.setPath(QtGui.QPainterPath())
|
||||||
return
|
return
|
||||||
|
|
||||||
path.addPolygon(p1[0] + p2[0])
|
|
||||||
|
for p1, p2 in zip(ps1, ps2):
|
||||||
|
path.addPolygon(p1 + p2)
|
||||||
self.setPath(path)
|
self.setPath(path)
|
||||||
|
Loading…
Reference in New Issue
Block a user