Plasma::Svg::paint

Alex Merry kde at randomguy3.me.uk
Wed May 4 01:06:26 CEST 2011


I have a question about the way Plasma::Svg::paint is supposed to work 
when an elementId is given, but a size is not.

The context for this is a bug I was fixing in bubblemon.  The bubblemon 
SVG has three elements; the background, the glass and the bubble.  The 
bubble is smaller than the other two elements.

The bubblemon applet resizes the bubblemon SVG to fit, and can retreive 
the scaled size of the bubble using Plasma::Svg::elementSize.  This 
works as expected: if the SVG has been scaled to half its natural size, 
m_svg->elementSize("bubble") will return a size half the natural size of 
the bubble element.

The problem comes when doing m_svg->paint(p, QPointF(x, y), "bubble").  
This will not paint the bubble at the scaled size.  Nor will it paint 
the bubble at the bubble's natural size.  Instead, it will paint the 
bubble at the size m_svg->size(); the scaled size of the whole SVG.

My question is: what is intended to happen here?  bubblemon was assuming 
that the bubble element would be scaled appropriately.  However, the 
systemtray applet, for example, assumes the current behaviour when 
drawing the "show hidden tasks" arrow.  The API documentation doesn't 
say either way.

Alex


More information about the Plasma-devel mailing list