[Panel-devel] rfc: Plasma::Theme and Plasma::Svg

Zack Rusin zack at kde.org
Tue Mar 6 21:50:58 CET 2007


On Tuesday 06 March 2007 14:27, Matt Broadstone wrote:
> Also, it might be cool if Plasma::Svg could just be a QPaintDevice so
> we could use it just like a QImage/QPixmap with all of this
> checking/caching/refcounting going on behind the scene.. 

I think you've confused QPaintDevice with something else. QPaintDevice's 
aren't shared by default at all. It's just so happens that these two specific 
ones are. QPaintDevice's aren't meant to be shared they're meant to be 
painted on, which is not the case for Plasma::Svg. Unless of course you want 
the use case to look like:
Plasma::Svg svg(100,100);
QPainter p(&svg);
p.drawLine(0, 0, 100, 100);
p.end();
But I'm not sure what this is supposed to be doing. And if it's meant to be 
saving svg's then Qt 4.3 comes with QSvgGenerator that is a QPaintDevice and 
allows just that (meaning saving QPainter rendering as svg's)

> images, it still provides the somewhat unintuitive api of svgrenderer
> (the whole calling paint/render on some other class to paint the
> image, 

It's not the image! Svg's /can/ be rendered to images, that's kinda the whole 
point behind Plasma::Svg. Svg's are not images because they don't have 
hardcoded resolutions and can be dynamically changing in time. It's just like 
saying that XHTML are images. The closest to a usecase of svg's in Qt is 
QMovie which emits frame's and would clearly not work for svg's because the 
whole point of QSvgRenderer is to have the ability to render vectors on any 
paint device not only QImage. So yeah, there's a reason it was done the way 
it is. And that reason is: any other way just doesn't come even close to 
cutting it. I kinda hoped that naming the darn thing QSvgRenderer would let 
people not think about it as of an image =)

z


More information about the Panel-devel mailing list