PDA

View Full Version : How to display QTableWidget fast with row > 10000?



chenw8
19th October 2007, 16:52
I use QTableWidget to display some dataset. If there are 10000 or more rows, it takes about 10 seconds. Is there anyway to speed up ? Thanks a lot.

MarkoSan
19th October 2007, 17:07
From my experience in Clarion all browse boxes were dynamically loaded in per-page fashion. Try to load only so much records that will fit in browse widget. (For example, if you have 10000000 records in file and your browse widget is capable of showing 50 records per page, load them only 50). I know this is a lot of work to do because you must then rewrite scroll bar handling methods, which is not simple at all.

jpn
20th October 2007, 08:52
QTableWidget is not designed as efficiency but as convenience in mind. You should consider switching to real model-view approach to have some efficiency. ;)

MarkoSan
20th October 2007, 11:37
QTableWidget is not designed as efficiency but as convenience in mind. You should consider switching to real model-view approach to have some efficiency. ;)

What do you mean with real model view?

marcel
20th October 2007, 11:47
He means QTableView. It is model based, while QTableWidget is item based.

jpn
20th October 2007, 12:29
There is a huge difference for example while adding items. With QTableView + model you can optimize it so that all the 10000 items gets added at time and then the view is updated once. On the other hand, adding 10000 items to a QTableWidget causes a lot of interaction under the hood, between the hidden built-in model and the view. It's just that QTableWidget has to be bulletproof and to work in every possible situation which also makes it slow, unfortunately.