PDA

View Full Version : Viewport and scene coordinates



aurelius
30th October 2008, 23:55
I have this difficulty. i think I am really messed up with all the different coordinates.

We have two classes, QGraphicsScene and QGraphicsView. The second displays the items of the first. Each of them has properties heigth and width. Also, they both have sceneRect.

When I resize the QGraphicsView, height and width change, as they supposed to. But the sceneRect remains the same.

In QGraphicsScene, sceneRect represents all the rectangular area of the scene. By default QGraphicsView's sceneRect covers the same area. They both are independent from the size of the window of the view.

Now, how do I connect the size of the window, that is the size of the QGraphicsView with the local coordinates of it. I mean, when I write setOffset(x, y), how am I sure that x, y are the distances from the top left of the widow, that is (0,0) ?

wysota
31st October 2008, 00:04
Please don't start multiple threads on the same problem.

aurelius
31st October 2008, 00:47
It's not multiple threads. Viewport or scene coordinates have nothing to do with "Image processing", which was the name of the other thread.