Results 1 to 2 of 2

Thread: Performance drops when using QGraphicsView

  1. #1
    Join Date
    Aug 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Exclamation Performance drops when using QGraphicsView

    Hi,


    I'm currently working on a project which involves showing continuously changing data as changing color blocks. The problem being: the color blocks must be able to be moved on the scene, that's why I'm using a QGraphicsView, and it appears to be WAY slower than a regular widget.

    You will find a zip filed attached illustrating the problem : testspeed.zip
    When you start the application you will see 8 QLabel's fading from yellow to green based on a sinus function. The color is applied to the label with a setPixmap(). The pixmap is filled every frame. This is relatively fast, I get results of 5000 Frames Per Second.

    Then you can check the checkbox "Use GraphicsView" and you will see the FPS drop ! Mine drops to 60! I don't understand that, because I use exactly the same procedure as the QLabels. In this case, QGraphicsPixmapItems are applied a pixmap with setPixmap() and the pixmap itself is exactly the same as the above procedure...


    Can someone help me improve the FPS ?

    Thanks in advance.

  2. #2
    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: Performance drops when using QGraphicsView

    One thing is that you have a loop that executes all the time which doesn't make sense. Another thing is that you are using pixmaps instead of just drawing rectangles which slows your program as well.

    On my computer GraphicsView approach is actually a bit faster than the label approach (3500fps vs 2400fps). I have modified your program (see attachment) and now the graphics view approach is about five times faster than the label approach (15000fps vs 2400fps). Enabling OpenGL might make it even faster but I didn't test it.
    Attached Files Attached Files
    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.


Similar Threads

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

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.