How to move an object in a specified path…
Hi..
how can i move an object(may be a dotted point) on a line.
I have seen the colliding mice example,but could not understand the code.
Suppose i have
QLine *line= new QLine(p1,p2); //where p1 and p2 are QPoint objects.
Now is there any way to move my object on that line?..If yes how?
Thanking you in advance…
2 replies
You have to use QPropertyAnimation class somehow like this snippet:
- QPropertyAnimation *animation = new QPropertyAnimation(yourObject, "geometry");
- animation->setDuration(10000);
- animation->start();
where p1 and p2 is your points and w and h are the width and the height of the object you plan to move.
You must log in to post a reply. Not a member yet? Register here!


