MousePressEvent, смещение позиции в QGraphicsView

У меня есть некоторые трудности сQGraphicsView а такжеQGraphicsScene. When I zoom/unzoom in the scene and create items with mousePressEvent, I have an offset in the position. How can this be avoided?

event.pos() похоже проблема ...

from PyQt4 import QtCore, QtGui

class graphicsItem (QtGui.QGraphicsItem):
    def __init__ (self):
        super(graphicsItem, self).__init__()
        self.rectF = QtCore.QRectF(0,0,10,10)
    def boundingRect (self):
        return self.rectF
    def paint (self, painter=None, style=None, widget=None):

class graphicsScene (QtGui.QGraphicsScene):
    def __init__ (self, parent=None):
        super (graphicsScene, self).__init__ (parent)

class graphicsView (QtGui.QGraphicsView):
    def __init__ (self, parent = None):
        super (graphicsView, self).__init__ (parent)
        self.parent = parent
    def mousePressEvent(self, event):
        super (graphicsView, self).mousePressEvent(event)
        item = graphicsItem()
        position = QtCore.QPointF(event.pos()) -
        item.setPos(position.x() , position.y())
    def wheelEvent (self, event):
        super (graphicsView, self).wheelEvent(event)
        factor = 1.2
        if < 0 :
            factor = 1.0 / factor
        self.scale(factor, factor)

class window (QtGui.QMainWindow):
    def __init__ (self, parent = None ) :
        super (window, self).__init__(parent)
        self.width = 800
        self.height = 600

        self.mainLayout = QtGui.QVBoxLayout(self)

        self.view = graphicsView(self)
        self.scene = graphicsScene(self)
        self.view.setScene (self.scene)

        factor = 1
        self.scene.setSceneRect(0, 0, self.width * factor, self.height * factor)
        self.view.setMinimumSize(self.width, self.height)


    def show (self):
        super (window, self).show()  

Ответы на вопрос(1)

Ваш ответ на вопрос