PDA

View Full Version : QGraphicsItem pos() method question!



zgulser
20th August 2009, 20:56
Hi,

I have again came with a new QGraphicsItem question:)

Well, I created a QGraphicsItem in which I draw a line in it by giving the start and end points of the line. I intentionally did not use setPos() method since the points are given. When I move my item, I observed the position of it by using pos() method. The pos() method returns me a point (0.12, 0.54). But what I don't understand is the following;

In the docs it says if the item has no parent, pos() has no difference with calling scenePos() and returns the item's coordinates in scene coordinates. Although the first claim is true( about the scenePos() ), the second claim did not work for me. Because, when I hover with the mouse over the last position of the item, the scene coordinates seems pretty different like (246, 345).

I interpreted it like, if you don't give a position for your item, then it'is origin is automatically set to (0,0) of the item's local coordinate system and pos() returns the value in local coordinates not in scene coordinates.

You make me very glad if you let me know your comments.

Thanks in advance.