PDA

View Full Version : How do i get QGraphicsLineItem coordinates?



chaltier
2nd April 2012, 05:21
So I did line->setLine(x1,y1,x2,y2) based on my mouse coordinates..

after i add the line to the scene..how do i get back their coordinates?

I had made them selectable and movable so i need to get their new position when i move them around.. (doing some sort of a save and load function)

so in order to save, i need to get their position (x1,y1,x2,y2), how do i go about doing that?

using line->pos() always returns me (0, 0)..

Thanks for the helpp..

ChrisW67
2nd April 2012, 05:41
QGraphicsLineItem::line() gives you the underlying line. Should be obvious after that.