Results 1 to 2 of 2

Thread: Performance Issue

  1. #1
    Join Date
    Dec 2008
    Posts
    31
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Performance Issue

    Hi,

    I have developed an application in Qt, all drawing is perfomed using QPainter.
    Application receives data from a socket and draw objects on the display, i also have a background Pixmap to display.
    The application is not responding when its loaded moderately i.e. display freezes.

    I have one class inherited from QWidget, which does all the drawing,
    can i make it as a Thread, by inheriting from QThread and call just painter->update(), function in that?
    Making all drawing as a seperate thread....so that performance is increased.

    Or is it much better to redesign my application using Graphics View.(I have not used Graphics View till now, so not very confident about it).

    Kindly looking forward to response....

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Performance Issue

    You may not access widgets (or QPixmap from any thread but the "gui thread"), i.e. the drawing has to be done in the main thread.

    You may, however, separate network communication, processing of the received packages in separate threads.

    Another point is that more than about 20 or 25 repaints per second will keep the cpu busy, but will not help the user too much.
    If you have more than 20 repaints per second, just update the internal data (w/o a repaint) and do periodic repaints (of this data) with a QTimer.
    If you access this data from multiple threads, you have to protect it with a mutex.

    HTH

Similar Threads

  1. QTextEdit Performance handling large paragraphs
    By netuno in forum Qt Programming
    Replies: 14
    Last Post: 1st September 2010, 23:58
  2. Replies: 4
    Last Post: 7th May 2008, 01:01
  3. Tabbed widget performance suggestions
    By MrGarbage in forum Qt Programming
    Replies: 0
    Last Post: 8th December 2007, 17:02
  4. Increasing performance from Qtextedit, listview, etc?
    By taylor34 in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2006, 11:20

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.