def mousePressEvent(self, event):
    self.lastPoint = event.pos()

def mouseMoveEvent(self, point):
    if RestrictedHorizontaly:
        x = point.x()
y = self.lastPoint.y()
ограничить подвижную область qgraphicsitem