Results 1 to 8 of 8

Thread: Need advice or how to increase drawing perfomance

  1. #1
    Join Date
    Sep 2010
    Location
    Russia, Moscow
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default Need advice or how to increase drawing perfomance

    Hello all!

    I'm making diagnostic program for my embedded project. Program connects with device over usb and recieve some data, but it's not important. Important thing is that recieved data have many discrete signals which i must show.
    Here is screenshot of my program:
    scr1.jpg
    (sorry for russian text on screenshot )
    On the left and right sides of program you can see rectangles with discrete signals(58 signals)...I'm drawing them by redefinition of paint method and painter.
    Main problem in update They must be updated every 500-1000 msec.

    So, here is question...what is the best way of solving this problem? Make timer and connect it to repaint method? But in this case perfomance will be very bad....
    Maybe exists other way?

  2. #2
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android
    Thanks
    10
    Thanked 27 Times in 22 Posts

    Default Re: Need advice or how to increase drawing perfomance

    First of all, are you sure it's really needed to update visible data with such interval? Even 1 second is very fast when there's lots of info.

    The second question is, are you redrawing all rectangles with text labels every update? Or only squares near labels should be updated?

    You can improve repainting performance using OpenGL, but I'm really not sure that it's the best solution for you.
    Oleg Shparber

  3. #3
    Join Date
    Sep 2010
    Location
    Russia, Moscow
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default Re: Need advice or how to increase drawing perfomance

    yep, i'm sure. Some discrete signals are pretty fast and i need to catch them =(
    Only rectangles need to be repainted, text near them is static.

    I thought about opengl, but i think it's like shooting a cannon at sparrows Using opengl for 58 rectangles....is bad idia i think
    I think, that best way is to make rectangles as widgets and update only them...

  4. #4
    Join Date
    Oct 2009
    Location
    Mexico
    Posts
    81
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    6
    Thanked 10 Times in 10 Posts

    Default Re: Need advice or how to increase drawing perfomance

    i dont know the spec of your project, but whit the info provided. maybe this solution are good.
    one possible solution are store the value of each signal every 500-1000 msec, but ONLY update the display every one or two second.


    sorry my poor english.

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

    Default Re: Need advice or how to increase drawing perfomance

    You can connect a timer to update() (instead of paint method), this would more optimized way. What was the reason for redefining the paint method, where as it looks like simple QCheckBox(s) in a vertical layout could have done the job.

    I don't think you will have performance issue with 58 signals (data), though care must to taken to update the complete widget / window at once in 500/1000 ms (don't paint the UI for each signal / data individually). If you use Qt standard widgets (like QCheckBox) and connect timer to update() slot, refreshing of widget is optimized internally (multiple update() in individual widgets will cause a single repaint on each widget, provided update() on all the widgets is called in same event exec cycle, i.e. inside the slot connected to timer).

    Also if you are expecting data over USB to arrive at ~500ms, I suggest to used some kind to queuing mechanism between the USB interface and UI component, this will ensure that you have a consistent UI performance. Also data queuing will be an option when you feel the response of UI is not upto the expected mark, generally the timer method should work.

  6. The following user says thank you to Santosh Reddy for this useful post:

    dkoryagin (17th November 2011)

  7. #6
    Join Date
    Sep 2010
    Location
    Russia, Moscow
    Posts
    15
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1

    Default Re: Need advice or how to increase drawing perfomance

    What was the reason for redefining the paint method, where as it looks like simple QCheckBox(s) in a vertical layout could have done the job.
    Handmade rectangles more beautiful

    Thanks all, i will try those methods today...

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

    Default Re: Need advice or how to increase drawing perfomance

    Just FYI you can use handmade rectangles in QCheckBox also. Refer Qt Style Sheets

  9. #8
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,345
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: Need advice or how to increase drawing perfomance

    I agree with Santosh and ecanela - break the connection between the rate at which you collect data, and the rate at which you update the display. No human can see the changes to 58 signals several times each second, so you really should update the display at the rate a human can process. Using a QTimer connected to an update() slot is a good way to go, I think.

Similar Threads

  1. Perfomance of Qt Gui Application on Windows
    By geronimo in forum Qt Programming
    Replies: 12
    Last Post: 2nd October 2011, 18:03
  2. How to test Graphics perfomance
    By moh.gup@gmail.com in forum Qt Programming
    Replies: 1
    Last Post: 4th May 2011, 20:41
  3. QTableView perfomance 2
    By hml in forum Newbie
    Replies: 6
    Last Post: 28th March 2010, 23:51
  4. Replies: 4
    Last Post: 15th March 2010, 13:52
  5. Replies: 8
    Last Post: 8th October 2009, 17:59

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
  •  
Qt is a trademark of The Qt Company.