Results 1 to 5 of 5

Thread: Best way to display lots of data fast

  1. #1
    Join Date
    Oct 2008
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Best way to display lots of data fast

    Hello,

    I need to make a visual widget that will update data that arrives very quickly from a hardware device. This will be for Windows, Linux, and Mac Basically you can think of it as very similar to a terminal displaying data arriving on a serial port. The data will be displayed as text at the bottom of the widget. When new data arrives, the old data will be scrolled up and the new data painted to the bottom row.

    In standard Windows programming this is simple, when data arrives you just scroll the window and redraw the bottom line. When a paint messgae comes in redraw all the data. I'm wondering if in QT it's better to use a QPainter or go the OpenGL route or perhaps sometihng else. My biggest concern initially was a comment in the help indicating that on a Mac you can't paint the widget outside of the paint event. This could be a problem as the paint event would have to be called every time the data arrived instead of simply scrolling the window and painitng the new area. There will be many of these Widgets in the application (maybe a hundred or so) but only a handfull will be visible at a time (though non-visible ones will still be processing incoming data) so efficiency is very important. The data that arrives for each widget will be handled in it's own thread.

    So what are my options here, pros cons, etc?

    Thanks

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Best way to display lots of data fast

    Did you have a look at model-view-programming ??

  3. #3
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Best way to display lots of data fast

    depending on what data you will actually display, the amount of data involved and how long you wish to keep the data available for view the "best" solution (if any) will vary.

    A good start, if you're data can be displayed as text (and need not be editable) is a trimmed down text edit (start from a QAbstractScrollArea and store lines of text to display in a QStringList, possibly removing old entries when reaching a given size limit). The all you have to do is to implement a simple line by line paint eventwhich really isn't difficult (a simple for loops of drawText() calls with a bit of coordinates manipulation).
    Current Qt projects : QCodeEdit, RotiDeCode

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Best way to display lots of data fast

    Quote Originally Posted by New2QT View Post
    My biggest concern initially was a comment in the help indicating that on a Mac you can't paint the widget outside of the paint event.
    On X11 you can, on Windows and the Mac you can't.
    So what are my options here, pros cons, etc?
    You can download Qwt ( http://qwt.sf.net ). It has an example called realtime, that generates random values painting them incrementally in a scatter plot. Maybe this helps to get an idea what is possible. You can also build Qwt against Qt3, what is obviously faster.

    Maybe have a look at QwtPlotCurve::draw ( qwt_plot_curve.cpp, line 483). It shows how you can transfer a paint operation into a paintEvent without repainting the complete widget. But don't expect such a solution being as fast as a thin wrapper around the native graphics system, what QPainter in Qt3 was.

    Uwe

  5. #5
    Join Date
    Oct 2008
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Best way to display lots of data fast

    Thanks all, this gives me plenty to get started with.

Similar Threads

  1. Replies: 12
    Last Post: 7th September 2011, 17:37
  2. Replies: 2
    Last Post: 29th September 2008, 01:08
  3. QListView and delegate to display data
    By T4ng10r in forum Qt Programming
    Replies: 5
    Last Post: 30th May 2007, 10:25
  4. First attempt to display serial port data on GUI
    By ShaChris23 in forum Newbie
    Replies: 12
    Last Post: 4th May 2007, 10:14
  5. speed of setdata - lots of items in treeview
    By Big Duck in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2006, 13:53

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.