PDA

View Full Version : how to do rectItem growing animation from origin?



ramfacts
4th May 2010, 06:22
hi,
i created QGraphicsRectItem. i want the animation as this item should be gradually increase in size from its origin.
i used the following api. but the item as well as moving from the origin.
animation->setScaleAt(a,b,c);

do you hav any solution by using only the QGraphics API's.?

-ram

Lykurg
4th May 2010, 07:35
Hi, see QGraphicsItem::setTransformOriginPoint().

ramfacts
5th May 2010, 05:40
Hi,
thank you for the reply.
but i want to grow the size of an item from origin to (x,y) without motion of item.

ramfacts
5th May 2010, 07:10
HI Lykurg,
I got that by QGraphicsItem::setTransformOriginPoint().
thanks.
ram

rashmi
12th November 2010, 06:42
i have got the same issue.
i used function which you specified in the following way but it gives me no result.

selectionItem->QGraphicsItem::setTransformOriginPoint (1000.0, 1000.0);

could you please help me with this issue.

thanks

Lykurg
12th November 2010, 07:19
What result do you expect and what do you get? And what is the size of selectionItem?

rashmi
12th November 2010, 07:34
expected result is to have zoomin effect i.e, selected item should grow from origin to (x,y) which in my case(100,100).

result of this does not give zoomin effect. i.e, selected item does not grow in size.

size of my selected item is this:

RectItem *selectionItem = new RectItem(QRectF(-225, -225, 450, 450),Qt::white, pad);

selectionItem->setTransformOriginPoint (100.0, 100.0);

this is what i have done.

expecting your review.

rashmi
15th November 2010, 04:07
hello all,

RectItem *rect = new RectItem(iconRect, iconColor, this);
rect->setTransformOriginPoint(50,50);

this is wat im trying to do i order to grow animation for origin to x,y in my case 50,50 but i dont get expected output. could some one help me.

qt-4.7
target window is directfb

pan
15th November 2010, 10:07
expected result is to have zoomin effect i.e, selected item should grow from origin to (x,y) which in my case(100,100).

result of this does not give zoomin effect. i.e, selected item does not grow in size.

I'm no expert, but from what I gather transform should move you object from one point to another.
setScale should allow your object to grow.

If you look at QGraphicsItem::setScale ( qreal factor ) you will see that it says there that it will scale at 0,0 but if you want it to scale at another point you need to use setTransformOriginPoint()