Hi,
I have few QGraphicsLineItems linked in a line one after the other. All of them have a QGraphicsItem as a parent, some "parents" have just one child and some few.
I want to update the positions of each line eachtime the others are moved. Until now it worked fine using "mapFromItem" in the starting point and the last point of each line, with the coords of the following and the previous items.
But when I create a new QGraphicsLineObject at the end of the queue, and if the previous parent object has been moved, the coordenade system is moved as well and "mapFromItem" is not right (it's moved a bit more, I thinks that's because the parent has been moved and its coordenade axis as well).
I tried with "mapToScene", but it doesn't work fine:
QPointF newPos
= mapToScene
(my_OLDItem
->line
().
p2());
my_NEWItem->setPos(NewPos); //my_NEWItem is a QGraphicsPixmapItem
QPointF newPos = mapToScene(my_OLDItem->line().p2());
my_NEWItem->setPos(NewPos); //my_NEWItem is a QGraphicsPixmapItem
To copy to clipboard, switch view to plain text mode
what should I map, and where? any idea? thanks!
Bookmarks