Results 1 to 8 of 8

Thread: How to avoid calling boundingRect() & shape()

  1. #1
    Join Date
    Sep 2007
    Location
    Pune, India
    Posts
    60
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to avoid calling boundingRect() & shape()

    Hi,
    I am using GraphicsView to display 15,000 > rectangle & 20,000 > lines joining them.
    But rendering speed is too slow ...I checked chip example but chip seems too fast as compare to my application. Even though chip is having more items on screen than my application.
    Can anybody tell me how to make it fast ??? any flag need to set ???
    Also boundingRect() & shape() function are getting called too many times. Can we avoid calling these functions to improve performance/rendering ? and how ??

  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: How to avoid calling boundingRect() & shape()

    Well, bitto suggested in a similar post to increase the scene's bspTreeDepth property. If you try this, make sure first that itemIndexMethod is BspTreeIndex.

  3. #3
    Join Date
    Sep 2007
    Location
    Pune, India
    Posts
    60
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to avoid calling boundingRect() & shape()

    By default item index method is BspTreeIndex, but as I want to move rectangles and lines adjoined it, it becomes very slow .
    Can you suggest any other method so that I can use to rendering.
    Also loading time is also too slow. How we can add items in Scene fastly & render it ?

  4. #4
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: How to avoid calling boundingRect() & shape()

    Can anybody tell me how to make it fast ??? any flag need to set ???
    add
    setViewport(new QGLWidget);
    in your constructor to make it fast.

  5. #5
    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: How to avoid calling boundingRect() & shape()

    Quote Originally Posted by nileshsince1980 View Post
    By default item index method is BspTreeIndex, but as I want to move rectangles and lines adjoined it, it becomes very slow .
    Can you suggest any other method so that I can use to rendering.
    Also loading time is also too slow. How we can add items in Scene fastly & render it ?
    Have you increased bspTreeDepth?

  6. #6
    Join Date
    Sep 2007
    Location
    Pune, India
    Posts
    60
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to avoid calling boundingRect() & shape()

    how to set setBspTreeDepth property for scene items ???
    Also I have tried setViewport(new OpenGLWidget) but it slowa down rendering,
    Is there is another way to make fast rendering ??

  7. #7
    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: How to avoid calling boundingRect() & shape()

    http://labs.trolltech.com/page/Proje...ys/DevDays2007
    The gv presentation might give you some tips to improve rendering speed.

    Have you cached the values to be returned in boundingRect() and shape() ? Probably you can inline them..

    Also have you profiled your app and tried to find out where exactly it is being slow ?

    P.S: Did you try out all the suggestions mentioned in the previous threads in this forum ?
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  8. #8
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to avoid calling boundingRect() & shape()

    I have had cases where NoIndex was significantly faster than BspTreeIndex. If not, play around with bspTreeDepth().

    Gopala's suggestion to cache bounding rects and shapes is also a good one. Most of the examples show calculating rects and shapes on the fly, but this is not good. Put a QRectF and a QPainterPath member in your item, and return them when requested. Also keep your shapes simple. Sometimes a loose approximation of the shape is sufficient.

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.