'How will I know the mouse position when mouse is clicked in QgraphicsView

I have a mouseReleaseEvent in my QGraphicsView class. By the way, I am using mouseReleaseEvent since if I used the mousePressEvent nothing will happen, no ellipse will be added to the the scene. I don't know how I can find the exact position of the mouse so that the I can use it as the position for my ellipse.Currenlty mo code can addEllipse but the position is not the same in the mouse, same in the picture here:

here

Update Image here self._scene = QtWidgets.QGraphicsScene(self)

 def mouseReleaseEvent(self, event):
    
        x = event.pos().x()
        y = event.pos().y()
        obj = self._scene.addEllipse(self._size/2, self._size/2, 10, 10,Qt.red) 
        obj.setPos(x,y)
        self.objects.append(obj)
        #self.posprev =pos

I tried using obj.ScenePos() to get the postion but it still does not work.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source