I have a scene = QGraphicsScene()
and I added an ellipse via scene.addEllipse(100, 100, 10, 10, greenPen, greenBrush)
. The brush and the pen are set before. I add the QGraphicsScene
right after to a QGraphicsView
with MyGraphicsView.setScene(scene)
. All of this works except the position of the ellipse is always the center. The first 2 parameters in the addEllipse()
function should be the coordinates (in this case 100, 100), but no matter what I put there, the ellipse is always in the center. Any ideas?
EDIT: now I added 3 ellipses like this (the one in the description deleted):
scene.addEllipse(10, 10, 10, 10, greenPen, greenBrush)
scene.addEllipse(-100, -10, 30, 30, bluePen, blueBrush)
scene.addEllipse(-100, -100, 60, 60, bluePen, blueBrush)
So clearly the coordinates work somehow, but I still don't get how exactly. Do I have to set an origin to the scene?
And if I do this:
particleList = scene.items()
print(particleList[0].x())
print(particleList[1].x())
print(particleList[2].x())
I get:
0.0
0.0
0.0
At this point I'm totally confused and I'd really appreciate some help.