PDA

View Full Version : Qt mimic jQuery shake effect



Cupidvogel
6th April 2015, 19:20
Here is how a jQuery shake effect looks like: jQuery site (https://api.jqueryui.com/shake-effect/) (just scroll down and click the box as it asks in the demo). I want to do a similar thing with a QWidget in my Qt app.

How do I do this? I am sorry that I am unable to post any code to show what I have tried till now, but I couldn't try anything at all, there doesn't seem to be any convenient animation API which will allow me to do such a thing. Of course I can make do with a timer, but that will be very clumsy.

anda_skoa
6th April 2015, 19:49
You are probably looking at the "wrong" (not ideal) UI technology. QtQuick is the one that makes animations very easy, almost trivial.

Cheers,
-

Cupidvogel
6th April 2015, 19:50
The project is not using QtQuick, so cannot resort to that. Any other way of doing it?

anda_skoa
6th April 2015, 20:56
You can try using a QPropertyAnimation on the widget's geometry property.

Cheers,
_

Cupidvogel
6th April 2015, 20:59
Yeah, found the API. Will try it and post further if I am stuck.