Results 1 to 2 of 2

Thread: Excess CPU usage during Paint

  1. #1
    Join Date
    Sep 2008
    Qt products

    Question Excess CPU usage during Paint

    My application requires to display data graphically and also has certain functionality like zoom and panning through the data.

    I also require the same design to show real time data read from a device, Although code for this task is not in place and we have already got an issue with the static data display.

    The issue is while application is displaying the graph on the screen, i see that there is sudden jump in the CPU usage, from 40- 60% and is remaining there till i remove the application moves to another screen where there is no graphics involved.

    I am using QGraphicsItem and overridden paint to use QPainter object for drawing.

    Is excessive usage of CPU with QGraphicsItem a common thing with Qt?
    If not, am i doing anything wrong to make system use so much of CPU time?
    If yes, are there any measures to take, to make the application perform better, as far as CPU usage is concerned?
    Also, please let me know i am not clear in explaining the issue.

    Qt version: Qt 4.4.3
    Target OS: Windows XP, Vista and Mac

    Thanks and Regards,

  2. #2
    Join Date
    Mar 2009
    Leiden, The Netherlands
    Qt products
    MacOS X Unix/X11 Windows Android

    Default Re: Excess CPU usage during Paint

    You don't have some sort of painting refresh loop running when displaying static data? Try debugging that first. It is normal if not displaying the scene, that the CPU usage will drop. What is your desired 'refresh rate' for the real-time DAQ?

    As I cannot see how many items you are using and the relevant code examples therefore, I can only give some basic ideas on performance, from my own experience:

    - Try disabling any QPen instances in use, as they will greatly affect performance.

    - Try painting on an OpenGL widget by invoking setViewport(new QGLWidget) on the associated QGraphicsView.

Similar Threads

  1. Drawing standard widgets using a custom paint engine
    By Waywocket in forum Qt Programming
    Replies: 26
    Last Post: 21st October 2010, 21:40
  2. Drawing a widget in QItemDelegate's paint method
    By darkadept in forum Qt Programming
    Replies: 17
    Last Post: 11th August 2009, 06:15
  3. Very high CPU usage with QTableView and MVC
    By montylee in forum Qt Programming
    Replies: 7
    Last Post: 24th March 2009, 07:14
  4. rotate operation and cpu usage
    By ersin.ozkan in forum Qt Programming
    Replies: 2
    Last Post: 30th December 2008, 07:42
  5. paint QTreeView item !!
    By mcenatie in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2006, 15:24

Tags for this Thread


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.