View Full Version : how to use kanimatedbutton?

22nd February 2010, 10:43
I'm new to KDE & pyQt.
I am trying to use kanimatedbutton and for now I have no luck,
the overall usage is like the usual Qt button but I dont have any luck on how to add the animation part.

I tried googling but I failed to find an example,
Can someone direct me to resources or example on how to use it?


I did find the KDEUI: KanimatedButton (http://api.kde.org/4.0-api/kdelibs-apidocs/kdeui/html/classKAnimatedButton.html) reference but they dont explain how to add icons or what file types or anything

23rd February 2010, 11:22
I'm not sure but as I see from the docs and the source code, I guess you have to use setIcons( const QString& icons ) to set the icons and then use start() to start the animation of the icons.
The doc says it "All you need to do is pass along a list of icon names and their size and everything else is taken care of."

23rd February 2010, 11:54
Thanks Archimedes for your reply (and many many inventions :) )
I've seen the setIcons func but,
from what path? how can I connect it to the resources? with is the format of the string?

I'm guessing you dont know,
Do people even use this control? (and again I'm a newbie)
I'm guessing that if it was a widely used control Google would give me more results...

24th February 2010, 13:12
Ok here is what I've tried.


Also open the file "process-working-kde.png" (it's located in /usr/share/icons/oxygen/16x16/animations) to see how the image is.
You'll see as 1 image all the frames of the animation.
I've also tried with .gif (no luck) and simple images that wasn't like the above image so I got 1 static icon in the button.

I created the following image in gimp. It's 16x240 with 15 squares that is 15 16x16 frames. Used it as the above code and worked.

24th February 2010, 13:29
Wow great, that takes me one step forward towards the solution :)

I started reading the KDE basics maybe I'll find how to set the path and connect it to a resource.


12th July 2017, 19:15
All you need to do is pass along a list of icon names and their size and everything else is taken care of." ??

28th July 2017, 10:16
You can find information about your question at: https://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKAnimatedButton.html

3rd April 2020, 14:40
Just to inform: if you change the iconSize() via setIconSize(), you will need to call updateIcons() also to force reloading of the correct icon size.