You could use a QRubberBand to setup the line and once you release it add the QGraphicsLineItem to your scene.