QGraphicsView Coordinate system problem
-
I have a problem with QGraphicsView coordinate system. I'm saving QGraphicsItem position and rotation in json file. I have changed the formula for delta x and y when I'm drawing an item (floorplan), but I'm setting the position as it was before, but now item is in different position. I'm setting the same values for scene rect as I had before to keep the coordinate system the same, but it doesn't work.
When I output scene height and width, item position and rotation they are the same, but items are in different positions.
Here is my code - https://gist.github.com/FaZeRs/1a2e32a34b3825ac1353db5c61d5b26bWhen loading old version http://i.imgur.com/Dy4nINL.png
When saving old version to new and reloading - http://i.imgur.com/Z5WT7t1.png -
Hi, and welcome!
@sref said in QGraphicsView Coordinate system problem:
I'm saving QGraphicsItem position and rotation in json file. I have changed the formula for delta x and y when I'm drawing an item (floorplan), but I'm setting the position as it was before, but now item is in different position. I'm setting the same values for scene rect as I had before to keep the coordinate system the same, but it doesn't work.
See https://doc.qt.io/qt-5//graphicsview.html#the-graphics-view-coordinate-system
- Do you save Item coordinates, Scene coordinates, or View coordinates?
- Do you load Item coordinates, Scene coordinates, or View coordinates?