Results 1 to 9 of 9

Thread: QSvgRenderer::boundsOnElement returns incorrect QRectF

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Posts
    6
    Thanks
    1

    Default QSvgRenderer::boundsOnElement returns incorrect QRectF

    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
    Attached Images Attached Images

Similar Threads

  1. Replies: 4
    Last Post: 8th July 2007, 14:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.