def mousePressEvent(self, event): ''' On mouse button down, create a new (infinitesmal) SegmentString and PointerTrackGhost. freehandTool remembers and updates SegmentString. ''' pointerEvent = PointerEvent() pointerEvent.makeFromEvent(mapper=self, event=event) ''' freehandCurve as QGraphicsItem positioned at event in scene. It keeps its internal data in its local CS ''' freehandCurve = SegmentString() self.scene().addItem(freehandCurve) freehandCurve.setPos(pointerEvent.scenePos) ''' headGhost at (0,0) in scene it keeps its local data in CS equivalent to scene ''' headGhost = PointerTrackGhost() self.scene().addItem(headGhost) self.freehandTool.setSegmentString(segmentString=freehandCurve, pathHeadGhost=headGhost, scenePosition=pointerEvent.scenePos) self.freehandTool.pointerPressEvent(pointerEvent)
def mouseReleaseEvent(self, event): pointerEvent = PointerEvent() pointerEvent.makeFromEvent(mapper=self, event=event) self.freehandTool.pointerReleaseEvent(pointerEvent)
def mouseMoveEvent(self, event): ''' Tell freehandTool to update its SegmentString. ''' pointerEvent = PointerEvent() pointerEvent.makeFromEvent(mapper=self, event=event) self.freehandTool.pointerMoveEvent(pointerEvent)