Hi,
I wrote a little program, which draws a ellipse(in the scene) when I click. Now I want to draw a line if I click on the ellipse and pull(then should appear a new ellipse with the line between them).
But I have no idea how to realize..
I hope somebody can give an example or a tip.

graphicsscene.cpp
Qt Code:
  1. void GraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *e)
  2. {
  3. pos=e->buttonDownScenePos(Qt::LeftButton);
  4. }
  5.  
  6. void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
  7. {
  8. pos=e->buttonDownScenePos(Qt::LeftButton);
  9. addEllipse (pos.x()-4, pos.y()-4, 8, 8);
  10. }
To copy to clipboard, switch view to plain text mode