Reputation: 15099
I'm planing on creating an application that will need to receive/show a lot of data in a QListWidget (or maybe QListView/QListModel) (I'm open to alternatives). The QListWidget will receive a huge number of items (+100) each second. I'll need to show all those items if/when scrollbar is used, and I'd like to achieve a non-sluggish effect.
If you have used Procmon (Windows only), that's a good example about what I'm talking about.
My question is: Can Qt handle that much data without being slow? What implementation should I take in mind?
Upvotes: 2
Views: 1065
Reputation: 19152
For showing a log, you can also use QTextDocument
or QTextEdit
. The implementation is more straight forward, and there is probably less overhead.
If you mix that in with a QSyntaxHighlighter
, then you can have a very readable easy to use log stream.
You could also implement some sort of paging or grouping of your data, where you can jump to the beginning easily or the most recent easily.
Another idea you could look at, is that most people don't want to try to look at so much data at once. You could aggregate the calls, and tally them up.
For example:
State 1 abcd
State 1 abcd
State 1 abcd
State 1 abcd
State 2 efg
could be represented as
State 1 abcd (x4)
State 2 efg (x1)
Or you could go with a graphical approach. Draw the stream of data using something like Qwt
or QGraphicsView
in some manner that makes sense for the large quantities of data you are displaying.
And finally, another way that may prove useful is to write it to the harddrive. Then have a button if the user wants to see the current log file.
Hope that helps.
Upvotes: 2
Reputation:
I suggest creating a small prototype and trying if the performance is good enough for you. I would say that QListView might be fast enough for you. Actually, when I worked with similar log views, I found the QTableView a little bit faster than the QListView.
But you should also consider whether the list view is the best possible user interface at all. When you have, lets say, 1 million items in the list (after an hour and a half), the scroll bar will be useless. You cannot use it for fine grained scrolling anymore except by clicking up/down arrows. And when you get 200 new items per second, it is not very useful to constantly draw those new lines, the user cannot read them anyway.
Upvotes: 2