Hello all,
I am trying to use QSvgRenderer to first render a static SVG in a QGraphicsScene and then, using QSvgRenderer::boundsOnElement, draw custom text inside elements that are specified in the svg.
My problem is that the QRect that boundsOnElement returns does *not* actually correspond to the element location in the svg, and so when I draw my text in the rect, it is drawn in the incorrect place. If you look at the attached screenshot, notice the following:
1) the widget I am talking about is the dark-grey colored box in the center of Amarok, at the bottom of the picture.
2) i have emphasized the 3 elements that I am talking about in this case, notice the 3 very bold/colorful rectangles in the middle of the svg.
3) notice at the *very bottom* of the picture, the text "Athlete". that text is supposed to be inside the first colored rectangle.
also, if you look at the console output, the following catches the eye:
the bounds of the topmost element (blue, where "athlete" should go), is (270, 412 285x9). this is the rect returned by QSvgRenderer::boundsOnElement. the size of the widget, as returned by QSvgRenderer::size, is (554, 230).
now, it doesn't even make sense for the position of the element to be outside the reported size of the widget. can anyone help shed some light on this, or point to what fundamental thing i'm doing wrong?
thanks,
leo
Bookmarks