Reputation: 1788
I have QListWidget which I need to move from one point to another but it has to be slow, something like animation. Can you help me with this.
Upvotes: 0
Views: 629
Reputation: 22187
You need to use Qt Animation framework for this. There are many samples available, so you should read it.
What you are trying to do can be done with QPropertyAnimation class, by animating geometry property of QListWidget
:
QPropertyAnimation animation(&lstWidget, "geometry"); //animate geometry property
animation.setDuration(5000); // 5 seconds
animation.setStartValue(QRect(50, 50, 100, 100)); // start value for geometry property
animation.setEndValue(QRect(300, 300, 100, 100)); // end value for geometry property
animation.start();
This will move from widget from (50,50) to (300, 300). You can set start value by reading geometry
property from lstWidget
to start moving from the current position, etc.
Upvotes: 1