Results 1 to 5 of 5

Thread: QGraphicsView properties and performance/memory

  1. #1
    Join Date
    May 2009
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QGraphicsView properties and performance/memory

    Hello to all,

    I am trying to visualize a cartesian 2D-plane with x/y axis in CAD app using a subclass of QGraphicsView.
    The QGV will be read-only, i.e. the user interaction will be minimal, mostly zooming and panning.

    My question is about choosing the right properties to leverage the performace and memory consumption of the QGV.
    The scene's rect is 25000x25000 and the intention is to display relatively few (<10, usually just one) pre-cached polygons containing about 100,000 points on average.

    I've already read some related posts (for instance, http://www.qtcentre.org/forum/f-qt-p...low-22392.html) and I'm trying to decide whether the CacheBackground flag is a an efficient choice - since user interaction is minimal and the view contents are cached.

    My initial thought was to override one of drawbackground() or drawItems() with DontSavePainterState, FullViewportUpdate flag set.
    Is this a good approach?

    Thanks in advance,
    v_kokk

  2. #2
    Join Date
    May 2009
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Question QGraphicsView properties and performance/memory

    Any thoughts guys?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QGraphicsView properties and performance/memory

    You have to test your approach and see if it is sufficient for you. If not, use a profiler, find the bottle neck and then we'll see if we can find a solution for it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    May 2009
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QGraphicsView properties and performance/memory

    Thank you for taking the time to reply.
    I have no real problem yet, since my code is in the early stages of development.
    I posted the question hoping to get some general rules of thumb regarding the behavior of QGraphicsView.
    I'm an MFC programmer, new to Qt, so I just started exploring the capabilities of Qt's paint engine - which
    are a lot!
    I've taken the time to examine the implementation of QGraphicsView in further detail and I think I got a
    better understanding of how it works.
    As far as I'm concerned it is the typical dilemma whether to "paint all, but in a simple way" or
    "try to be smart, but suffer the overhead of additional calculations".
    Anyway, thanks again.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QGraphicsView properties and performance/memory

    At this point I can only advise to cache items and set QGLWidget as the viewport of the view.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    vkokk (17th July 2009)

Tags for this Thread

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.