PDA

View Full Version : QGraphicsItem::scenePos() or pos()



Gopala Krishna
8th February 2007, 13:05
This may sound like dumb simple question but I rather felt its better to clarify.
I am 100% sure that I am not using "parent - children" amongst QGraphicsItems in my app. So is it better to use scenePos() or pos() ? Any performance differences ?

Gopala Krishna
11th February 2007, 19:06
Is there absolutely no answer from anyone? :confused:

jpn
11th February 2007, 19:14
It should be quite easy to judge:


QPointF QGraphicsItem::pos() const
{
return d_ptr->pos; // returns a member variable of the private implementation class (the pos is maintained while moving the item)
}

QPointF QGraphicsItem::scenePos() const
{
return mapToScene(0, 0); // uses QMatrix to map (0,0) to scene coords
}

Use the power of provided Qt sources! ;)

Gopala Krishna
11th February 2007, 19:23
Use the power of provided Qt sources! ;)
Very correct, should have done that :( Probably it might help other newbies atleast ;)