Results 1 to 5 of 5

Thread: QSvgRenderer bounds question

  1. #1
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default QSvgRenderer bounds question

    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.
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSvgRenderer bounds question

    The root element id in any svg file should be "svg". So you can use this id and get the root element bounds.

  3. The following user says thank you to marcel for this useful post:

    Gopala Krishna (30th November 2007)

  4. #3
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QSvgRenderer bounds question

    Wow marcel , thanks a ton for your rocket quick reply
    My immediate question, why doesn't QGraphicsSvgItem use this and use QSvgRenderer::defaultSize() instead ?
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  5. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSvgRenderer bounds question

    I have no idea. Aren't they equal?

  6. #5
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QSvgRenderer bounds question

    Quote Originally Posted by marcel View Post
    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.
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

Similar Threads

  1. QPainter bounds question
    By Micawber in forum Qt Programming
    Replies: 3
    Last Post: 23rd October 2007, 14:09

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.