Results 1 to 3 of 3

Thread: Low Performance in QGraphicsView

  1. #1
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Low Performance in QGraphicsView

    Hi,
    I'm developing something like a Gantt diagram (see attached image):
    example.PNG

    I have a QTimer that every 100msec update my time cursor (the black vertical line) in the diagram and other widgets but I noticed that the effective update rate is more than 100ms.

    First of all, I known that the QTimer isn't so perfect in timing however, without my time cursor update, other widgets are updated about every 110 msec (but this is another story ).

    Adding my time cursor update the performance is degraded so checking my code I found that the QGraphicsView:aintEvent execution time is about 60-70msec.

    Cursor time is drawed in MyGraphicsScene::drawForeground such as the dotted horizontal line are dreawed in MyGraphicsScene::drawBackground.

    As suggested in other posts:
    • Horizontal green rectangle are items having cache enabled ( setChacheMode (ItemCoordinateCache) ).
      I can't set view interactive property to false because I need my scene to be clickable.
      I'm using Qt 4.5.0 so I can't set ItemHasNoContents flag
      I haven't explicit set the OpenGL engine so I suppose that I'm using the raster one


    How can I increase my perferomace reducing the QGraphicsView:aintEvent execution time so that I've an update rate near to 100msec?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Low Performance in QGraphicsView

    How can I increase my perferomace reducing the QGraphicsView:aintEvent execution time so that I've an update rate near to 100msec?
    Think again, is it really required to update at 100ms rate?

    Can't you update every 1000 ms with 10 samples?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Low Performance in QGraphicsView

    ... without my time cursor update, other widgets are updated about every 110 msec (but this is another story ).
    No, I think that is the story. If the scene take 110 milliseconds to update and paint then that's the fastest it will update unless you do something about that. Adding the single line cursor is clearly not an impost in itself, it just cannot be drawn every 100msecs because the processor will still be drawing the bars when the timer notionally fires.

    I cannot imagine the every bar in the scene is actually changing every tenth of a second. Are you changing things that don't need to be changed and invalidating the caching?

Similar Threads

  1. QGraphicsView performance problems
    By MarPan in forum Newbie
    Replies: 10
    Last Post: 14th August 2010, 21:24
  2. QgraphicsView performance
    By nileshsince1980 in forum Qt Programming
    Replies: 2
    Last Post: 15th February 2010, 11:54
  3. again QGraphicsView performance
    By medved6 in forum Qt Programming
    Replies: 11
    Last Post: 21st December 2009, 21:11
  4. QGraphicsView performance in 4.6
    By Lodorot in forum Qt Programming
    Replies: 2
    Last Post: 20th September 2009, 23:09
  5. QGraphicsView performance
    By Halabund in forum Newbie
    Replies: 3
    Last Post: 17th April 2009, 10:12

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.