[Qt-interest] QGraphicsSvgItem scalling image question

franki franki at franki.eu.org
Tue Aug 23 14:27:18 CEST 2011


Dnia wtorek, 23 sierpnia 2011 o 13:30:53 Pritam Ghanghas napisał(a):
> On Tue, 2011-08-23 at 15:32 +0530, franki wrote:
> > Dnia poniedziałek, 22 sierpnia 2011 o 14:56:06 franki napisał(a):
> > > Hi,
> > > 
> > > I have some items on QGraphicsView that represents icons. Icons are
> > > clickable and can change look (e.g. switch on/off) I need these icons
> > > to come in different resolutions without lose of quality, so I tunerd
> > > to QGraphicsSvgItem, supposedly this is Scalable Vector Graphics. But
> > > I can find no way to change icon resolution. I've googled and all I've
> > > got is that I could change some parameters in svg file before loading,
> > > simply by parsing it. But with complex icon's that nearly impossible,
> > > or at least highly cumbersome.
> > > 
> > > 	I do have however setScale() function that somes from QGraphicsItem,
> > > 	but
> > > 
> > > this is just applying transormation matrix onto item, and the item does
> > > not have to be svg item,
> > > 
> > > 	So my question is: Do I get this right? Only possible scalling is by
> > > 
> > > setScale function or parsing svg text file? Because if so, what
> > > advantages gives me using svg format? Does this downscale better that
> > > png format giving better item quality?
> > 
> > Please anyone..
> > I know it may be stupid question, but is it possible that function scale,
> > or setScale inherited from QGraphicsItem by QGraphicsSvgItem, takes
> > advantage of SVG file and render it without loss of quality in different
> > size? SVG Cards example is doing this that way, setting scale for every
> > item form one svg file.
> 
> setScale() should result in properly scaled svg Item (lossless). It
> should be very easy to check.
> create the item,
> set the scale to be very huge may be 20x and then look for artifacts.
> If scale is being applied after rasterization, you will get very visible
> ugly looking pixel blocks.

Thanks it's seems to be OK, as far as I can tell there is no ugly looking 
pixels, at least under qt simulator..., but usually items look beter on N8 
than on simulator ;)

Thanks
Marek




More information about the Qt-interest-old mailing list