Search code examples
pyqtpyqt5qgraphicsscenepyside2qgraphicspathitem

pyside2 QGraphicsPathItem WindingFill


Hi i have a question about how to properly fill a QGraphicsPathItem in pyside2 (pyqt). currently i am writing a gerber file visualizer and for shapes with multiple geometry i am using a path to have these as one object.

although when filling the item it is leaving gaps in some but not all of the paths area.filled objects the objects labled 1,2 and 3 area all single path objects created in the same way but are being filled differently. this is using the fill rule Qt.WindingFill.

1) is being filled correctly

2) where the circles are overlapping 1 other object it is clear but where it is overlapping 2 other objects it is filled (this looks like oddevenfill)

3) i couldn't say what is going on here i have no idea

this is the crude process of how the path is built just a rectangle then another layered sideways with 4 circles on the corners enter image description here

minimal code example for referance: enter image description here

I have experimented with just using single objects so 2 QgraphicsRectItems and 4 ellipse items and the end result is fine but then i have 6 objects over 1 and there are potentially thousands of these so performance is the pain reason to use a path item over loads of single items.

so my question to summerise is why is it filling them differently and is there a way i can have it not do that?


Solution

  • fix it, problem was something i dont remember but it was to do with the polygon not being drawn correctly