PDA

View Full Version : QTimer



nirup
29th May 2007, 14:08
Hi friends,

i am programing on QT4.2.3 with a crossplatform of VC++

i need a help in the programing i am doing.

i have object in a plane which is to be move from one position to the other when i click on the button start like from the initial ponint to the final point. and ever time it make a move the object should be displayed.

below is the function.

Void Way::moveObject()

while(pxSquare->x() < 200 || pxSquare->y() >0) //does not exceed the plane
{
pxSquare->setPos(pxSquare->x() + 4, pxSquare->y() - 4);
//onclick moves a step
pxSquare->x() + 4; // incremants x value
pxSquare->y() - 4; //decremnts y value
}

however when i run this the object directly shows the fnal position,
n what i want is every time it makes a move it should be diaplyed on the plane. where in i can increase n decreese the speed of the object..

thanks in advance

jpn
29th May 2007, 14:13
Check out QGraphicsItemAnimation.