Results 1 to 5 of 5

Thread: QGraphicsScene performance

  1. #1
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QGraphicsScene performance

    I have a QGraphicsScene with some items that inherit QGraphicsPixmapItem, and change their displayed pixmap at the advance() function.

    Even though QGraphicsScene is supposed to have a very good performance with a million items, 20*15 of my items at size 32px*32px at 25 fps generates 95% CPU usage (CPU is an AMD Athlon XP 2200+). 40*30 if these items with 16px*16px size make 100% CPU usage, and lag.

    What should I do to have reasonable performance?

  2. #2
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QGraphicsScene performance

    Need more detail. How are you changing the displayed pixmaps? Are the pixmaps cached? 300 pixmaps changing at 25FPS is 7500 pixmaps to load per second. That's a lot if they're all different.

  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: QGraphicsScene performance

    Cache, cache, cache and turn off bsp tree indexing if your items are moving or changing their boundingRect.

  4. #4
    Join Date
    Jan 2008
    Posts
    25
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsScene performance

    All pixmaps are stored in a QList<QPixmap>, and are preloaded.

  5. #5
    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: QGraphicsScene performance

    Rendering pixmaps is slow work. If you do any sort of transforms, it's worse. You might try using an OpenGL engine for Graphics View. My webcast on Graphics View (ICS Network) has some other tips.

Similar Threads

  1. Replies: 12
    Last Post: 7th September 2011, 16:37
  2. GraphicsView performance problems
    By Gopala Krishna in forum Qt Programming
    Replies: 79
    Last Post: 8th August 2007, 17:32
  3. When to use QGraphicsScene or QWidget
    By fossill in forum Qt Programming
    Replies: 2
    Last Post: 9th February 2007, 23:58
  4. [QT 4] QTextEdit performance
    By fellobo in forum Qt Programming
    Replies: 8
    Last Post: 6th March 2006, 19:27

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.