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
{
pos=e->buttonDownScenePos(Qt::LeftButton);
}
{
pos=e->buttonDownScenePos(Qt::LeftButton);
addEllipse (pos.x()-4, pos.y()-4, 8, 8);
}
void GraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *e)
{
pos=e->buttonDownScenePos(Qt::LeftButton);
}
void GraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
{
pos=e->buttonDownScenePos(Qt::LeftButton);
addEllipse (pos.x()-4, pos.y()-4, 8, 8);
}
To copy to clipboard, switch view to plain text mode
Bookmarks