I'm making an application and I want to connect certain items in the QGraphicsScene by using lines. I want this done in real time, so while I'm holding the mouse down and trying to draw the line I want to see the line being drawn. I've written some code to allow this but the problem with this code is that it keeps on clearing everything and I dont know a way around this. Any help would be much appreciated.

class graphicsScene(QtGui.QGraphicsScene, QtGui.QWidget):
self.pen = QtGui.QPen(QtCore.Qt.black, 3, QtCore.Qt.SolidLine)


def mousePressEvent(self, event):
if connectLine_cs == 1:
self.cursorStartPosition = event.scenePos()
self.start = QtCore.QPoint(self.cursorStartPosition.x(),self.cu rsorStartPosition.y())

def mouseMoveEvent(self, event):
if connectLine_cs == 1:
self.cursorCurrentPosition = event.scenePos()
current = QtCore.QPointF(self.cursorCurrentPosition.x(),self .cursorCurrentPosition.y())
self.clear()
link = QtGui.QGraphicsLineItem(QtCore.QLineF(self.start, current))
link.setPen(self.pen)
self.addItem(link)