PDA

View Full Version : How to make a such button? Need help quick



bcdurak
19th May 2013, 21:37
Hey everyone
I have some kind of a project in my mind and i need some advice to be able to program it. So all i need to do create 1 basic button. When people click the button, the button will move horizontally back and forth (kinda like a wave) for some certain amount of time. I watched many tutorials but i couldnt find anything similar so if you guys have any ideas how to build something like this it would be so great if you would share some ideas with me.
Anyway thank you and have a nice day :)

amleto
19th May 2013, 22:23
Make an empty widget to hold the button.
Make a button
Make a timer
Attach clicked() signal of the button to start the timer
Attach timeout signal of the timer to some slot that moves the position of the button in the form (need to check for 'collisions' with the edge of the form here)

I'll leave up to you to figure how to deal with stopping the button moving.

ChrisW67
19th May 2013, 23:21
QPropertyAnimation will probably be of interest

wysota
20th May 2013, 06:57
And QSequentialAnimationGroup :)