I just looked at your original code again and can't understand why you are doing this:
path2.addPolygon(el1.toFillPolygon())
path2.addPolygon(el2.toFillPolygon())
self.myPolygon = path2.toFillPolygon()
el1 = QtGui.QGraphicsEllipseItem(-133.3333,-80,160,160).shape()
el2 = QtGui.QGraphicsEllipseItem(-26.66667, -80, 160, 160).shape()
path2 = QtGui.QPainterPath()
path2.addPolygon(el1.toFillPolygon())
path2.addPolygon(el2.toFillPolygon())
self.myPolygon = path2.toFillPolygon()
To copy to clipboard, switch view to plain text mode
Creating two QGraphicsEllipseItem instances just to get their polygons doesn't make a lot of sense, when this would be much more straightforward:
path2.addEllipse(-133.3333,-80,160,160)
path2.addEllipse(-26.66667, -80, 160, 160)
self.myPolygon = path2.toFillPolygon()
path2 = QtGui.QPainterPath()
path2.addEllipse(-133.3333,-80,160,160)
path2.addEllipse(-26.66667, -80, 160, 160)
self.myPolygon = path2.toFillPolygon()
To copy to clipboard, switch view to plain text mode
I am also not clear why you need self.myPolygon when there is already a QGraphicsPathItem class. You simply create your QPainterPath, add the two ellipses, and set that path on your QGraphicsPathItem instance. No need for all this conversion to polygons.
Bookmarks