PDA

View Full Version : How to optemize QTableWidget?



mismael85
6th November 2010, 23:12
Hi,
I have a problem now ,I have a QTableWidget with 6 columns and more than 100628 row. It means (6 * 100628) of QTableWidgetItem. so when i fill the table the following two problems are arising :-
1- the application takes 1 minute approximately to fill the table(which is a long time for me).
2- the application takes a huge memory in the RAM.

so i thought that i should only display a limited number of rows and when the user scroll down, another rows are displayed.
is that possible ? how?
is there any better way to do this?
thank you

wysota
7th November 2010, 01:33
is there any better way to do this?
Yes, use QTableView with a model.

mismael85
7th November 2010, 11:27
but i think that QTableView also loads all the items at startup. and also loads all of them in the memory.
or it just loads the displayed items?

tbscope
7th November 2010, 11:32
but i think that QTableView also loads all the items at startup. and also loads all of them in the memory.
or it just loads the displayed items?

That depends on the model.
See the canFetchMore() and fetchMore() functions.