PDA

View Full Version : pos() and scenePos() problem



sjwang
14th June 2010, 00:08
Hi all,

In a QGraphicsScene, I created a QGraphicsPixmapItem object with no parent and set its transformation origin point to the geometrical centre, then a series of transformations were performed by calling setPos() and setRotation().

The weird problem was that, when I translated the object with
setPos(this->scenePos() + delta), the transformation messed up, but
setPos(this->pos() + delta) worked fine.

According to the documentation, pos() is the equivalent to calling mapToParent(0, 0), and scenePos() is the equivalent to mapToScene(0, 0). But the result was not: mapToParent(0, 0), mapToScene(0, 0) and scenePos() returned the same coordinates, while pos() returned a different one.

Totally no idea, what is the coordinate returned by pos() then? Could it be a bug with Qt?

Thanks.

wysota
14th June 2010, 00:35
Please provide a minimal compilable example reproducing the problem.