Review Request: KPixmapSequence: painting spinners made easy

Andreas Pakulat apaku at gmx.de
Mon Aug 17 20:59:58 BST 2009



> On 2009-08-17 12:35:49, Andreas Pakulat wrote:
> > Just two questions:
> > 
> > - how does this relate to KAnimatedButton, which basically does the same for a toolbutton's icon, except that one needs to have a png-sequence to get the right animation
> > - could I use this to overlay a spinner on top of an existing icon in a button, without knowing where exactly the icon will be drawn
> > 
> > ?
> 
> Sebastian Trueg wrote:
>     KAnimatedButton could be implemented using the sequence painter.
>     I don't understand your second question: what do you mean by "without knowing where the icon will be drawn"? You can overlay the spinner on top of anything, also a button. And you can align it however you like. Typical (and default) usage would be centered.
> 
> Andreas Pakulat wrote:
>     What I mean is that I have a QToolButton (or push button, doesn't really matter) that has an icon and also some text. Now I'd like to be able to overlay a spinner on top of the icon, without having to find out the actual position of the icon myself (by asking the style or whatever).
> 
> thomasl wrote:
>     From some query on kde-devel i think this here is supposed to overlay the (any) /entire/ widget and display a rotating "Please wait" indicator on top - so there's no relation to KAnimatedButton at all.
>     
>     I fear you'll have to (like KAnimatedButton) reimplement Q*Button for your purpose.
>     
>     QStyle doesn't provide a subelement rect for the icon (only the content) so after forcing the button to have an icon (agains the KDE global setting) you could only estimate it's position from the buttons content rect and the layout direction.
>     
>     Afaik KAnimatedButtons won't display text at all.

I don't need to re-implement anything, as the buttons in question are already KAnimatedButton. But its a bit ugly to switch between a rotating icon and one that doesn't rotate. Ideally I'd like to just have an overlay on top of the icon.

Regarding the "forcing the button to have an icon", thats actually quite normal for a QToolButton and doesn't go against KDE settings because that toolbutton is not in the toolbar :P

And yes, KAnimatedButton does display text.

Well, too bad this is not what I was hoping for :(


- Andreas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/1345/#review2052
-----------------------------------------------------------


On 2009-08-17 15:05:35, Sebastian Trueg wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/1345/
> -----------------------------------------------------------
> 
> (Updated 2009-08-17 15:05:35)
> 
> 
> Review request for kdelibs.
> 
> 
> Summary
> -------
> 
> Showing a spinner to indicate a work in progrss is a typical task. Gwenview does have a nice spinner when loading images. Aurelien and I extracted the code from Gwenview and molded it into three nice classes that allow to create spinners very easily in any situation. At the moment the classes are used in Gwenview and in Nepomuk.
> 
> KPixmapSequence: a simple container class that loads a sequence of pixmaps and provides the frames through a simple interface.
> KPixmapSequenceOverlayPainter: Installs an event filter to paint a KPixmapSequence onto any widget using Qt::Alignment or a relative placement.
> KPixmapSequenceWidget: A simple widget using the overlay painter to draw a spinner while the widget is visible.
> 
> We propose an addition to kdeui.
> 
> 
> Diffs
> -----
> 
>   trunk/KDE/kdelibs/kdeui/util/kpixmapsequencewidget.cpp PRE-CREATION 
>   trunk/KDE/kdelibs/kdeui/util/kpixmapsequencewidget.h PRE-CREATION 
>   trunk/KDE/kdelibs/kdeui/util/kpixmapsequenceoverlaypainter.cpp PRE-CREATION 
>   trunk/KDE/kdelibs/kdeui/util/kpixmapsequence.cpp PRE-CREATION 
>   trunk/KDE/kdelibs/kdeui/util/kpixmapsequenceoverlaypainter.h PRE-CREATION 
>   trunk/KDE/kdelibs/kdeui/util/kpixmapsequence.h PRE-CREATION 
>   trunk/KDE/kdelibs/kdeui/CMakeLists.txt 1006831 
> 
> Diff: http://reviewboard.kde.org/r/1345/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Sebastian
> 
>





More information about the kde-core-devel mailing list