PDA

View Full Version : QSvgRenderer bounds question



Gopala Krishna
30th November 2007, 19:27
What is equivalent of using QSvgRenderer::boundsOnElement( group id) with a svg without any particular group id and that being the only element present in svg file ?
I want to find out bounding rect of my custom svg item( i mean i have implemented a svgitem class on my own). I can't use QGraphicsSvgItem due to inheritance problem in my app.

marcel
30th November 2007, 19:53
The root element id in any svg file should be "svg". So you can use this id and get the root element bounds.

Gopala Krishna
30th November 2007, 19:58
Wow marcel , thanks a ton for your rocket quick reply :)
My immediate question, why doesn't QGraphicsSvgItem use this and use QSvgRenderer::defaultSize() instead ?

marcel
30th November 2007, 20:21
I have no idea. Aren't they equal?

Gopala Krishna
30th November 2007, 20:33
I have no idea. Aren't they equal?

Nope. QRectF(QPointF(0,0), defaultSize()) is a rect with origin in topleft where as boundsOnElement returns the appropriate rect based on how you have it in svg file - for eg the svgs i use are *centered* at (0,0) enabling uniform transformations to be applied.