PDA

View Full Version : Advice on what is best to use when displaying lots of numerical data



Drew
13th May 2011, 10:00
Hi,
I'm recently new to QT - and want some advice about displaying lots of numerical data.

I'm attempting to write a front end to my trading application, the requirements are that it would need to display about 100 rows each with 50 columns of data - where about 5 columns in each row might be changing fairly rapidly. I also want some columns displaying as checkboxes instead of data, and maybe some columns as drop downs. Some columns would be read-only, while others would be read/write - and after changing a value I need to detect which row/column has changed.

What I am currently thinking is start with either a QTableView, QTreeView or a QTreeWidget. QTableView and QTreeView seems to be better at displaying row data (compared to QTreeWidget) - but I'd have to add my own code to do checkboxes/drop downs etc

Performance is something I also need to consider - I might potentially want to expand it to display 1000's of rows.

I've been playing around with all three of the above - QTreeWidget can do checkboxes, but manipulating the data is a bit trickier.

Or is there a better way(s)?

Any advice/options would be welcome.

Drew
16th May 2011, 01:42
Surely someone must have an option? Help a new guy out :)

DanH
16th May 2011, 02:31
Only you understand your requirements. There are a dozen different techniques that could be made to work, some easy, some not so. Some (sort of) fast, some slow. Some that will be pleasing to the eye, many that won't.

You'll have to try several techniques and see what works for you.

ChrisW67
16th May 2011, 02:43
QTableView (it is tabular data after all) and a model that supplies your data. You can control read/write ability with the flags method. Checkboxes using the relevant role in the data() call. The model knows when the user changes a value because setData() has to store it. A custom editor for a column can be done with a delegate and QComboBox etc.

The precise details of the solution are up to you and your customer.

Drew
16th May 2011, 02:50
Thanks Dan - that's a fair call. I suppose what I'm interested in hearing is about any of these dozen different techniques - especially those that don't use any of the things I've mentioned in the OP. Currently I'm learning towards using a QTableView or QTreeView - just want to beware of any potential gotcha's.

If anyone's used had experience displaying large datasets and had success/problems - I'd be interested to hear their learnings (ie would they recommend it or if they were going to do it again, would they do it differently).

Cheers

[Edit] - Thanks also Chris - I was posted this and then saw your response

SixDegrees
16th May 2011, 08:09
Putting thousands of user interface widgets on display is almost certainly not going to perform well, particularly if many of them are receiving updates rapidly. You may be better off simply painting a grid yourself. If the checkboxes are for display only (not interactive) this would be fast and trivial - just reuse a check image over and over, along with a blank or unchecked image. If you need interactivity, that would take a little more work - but not very much, as it's just a matter of capturing mouse clicks and resolving them to a given rectangular area. This will almost certainly give you the best performance.

But as others have said, it's really impossible to provide any guidance without more specific requirements.

DanH
18th May 2011, 04:49
Thousands of data points are better displayed as some sort of graph. I've seen many implementations where details about any particular data point are displayed in a pop-up when you hover the cursor over a point in the graph, eg, if you need to provide access to the detailed data.

It would also help to know whether you're talking phone (I hope not) or desktop.