PDA

View Full Version : how to use kanimatedbutton?



ManicQin
22nd February 2010, 11:43
Hi,
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?

Thanks!

p.s.
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

Archimedes
23rd February 2010, 12: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."

ManicQin
23rd February 2010, 12: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...

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



animateBut->setIcons("process-working-kde");
animateBut->start();


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.

ManicQin
24th February 2010, 14: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.

Thanks!

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

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

StephieJoe
3rd April 2020, 15: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.