Hi,
I have a very trivial question.I'm getting some sort of odd values from the newPos.x() & newPos.y() values in itemChange method. The odd about it is the item's position is not returned in scene coordinates...Do you have any idea?
Hi,
I have a very trivial question.I'm getting some sort of odd values from the newPos.x() & newPos.y() values in itemChange method. The odd about it is the item's position is not returned in scene coordinates...Do you have any idea?
Last edited by zgulser; 17th August 2009 at 07:36.
QGraphicsItem::itemChange .. it will return only in item coordinates ...
ex:
QTDIR/demos/embeddeddialogs/customproxy.cpp
use
QPolygonF QGraphicsItem::mapToScene ( const QRectF & rect ) const
to map the coordinates to scene ...
"Behind every great fortune lies a crime" - Balzac
zgulser (17th August 2009)
Hımm..thanks for your answer.
By the way, what about the QGraphicsItem::contains(QPointF point) method? I mean does the point searched in the item's local coordinates? In the documentation, it says "local coordinates". Does it mean item's coordinate system? More clearly, what the mechanism behind the QGraphicsItem::contains(QPointF point) method?
Thanks in advance.
absolutly .... from docs it says ..it says "local coordinates". Does it mean item's coordinate system?
QGrahpicsItem::contains() takes a point argument in item coordinates only ...Items live in their own local coordinate system
The Graphics View Framework will explain u clearly than me ..
"Behind every great fortune lies a crime" - Balzac
Ok buddy, thanks again.
Oh, I'm about to forget to ask...If the item coordinate system is taken into account in contains method, how do I make sure that the given point to be searched will be mapped to item coordinate system. Do I really need to worry about that or QGraphicsView framework does the transformation automatically?
Last edited by zgulser; 17th August 2009 at 09:50.
Bookmarks