PDA

View Full Version : QTableWidget and memory



hannesvdc
21st December 2010, 22:19
Hi,

Yesterday, i was practising my qt experience with tables( QTableWidget ) and i set the rowcount on 100.000 en the columncount on 600. I just wanted to imitate an excel spreadsheet table. But i saw that it took more than 40 MB of memory for the table, while excel takes only 6 MB for a whole application!
Can someone tell me why there is such a big difference in memory?

hannesvdc

Lykurg
21st December 2010, 23:34
I don't use excel and I don't know the source code of excel. But if you would use a model and QTableView the memory would surly shrink since only the actually shown parts would be "load into memory".

hannesvdc
22nd December 2010, 07:33
Thanks for reply.

I decided to make my own model inherited from QAbstractItemModel. What should this
class implement and what shouldn't it?

hannesvdc

Lykurg
22nd December 2010, 08:57
If you want to use a table why do you don't use QAbstractTableModel? For how to deal with custom model have a look at "Model/View Programming" in the docs (the section "Creating new models" should be your special interest)