Results 1 to 4 of 4

Thread: QTableWidget and memory

  1. #1
    Join Date
    Sep 2010
    Posts
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTableWidget and memory

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QTableWidget and memory

    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".

  3. #3
    Join Date
    Sep 2010
    Posts
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget and memory

    Thanks for reply.

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

    hannesvdc

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QTableWidget and memory

    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)

Similar Threads

  1. memory corruption
    By Rambobino in forum Qt Programming
    Replies: 2
    Last Post: 10th August 2010, 21:35
  2. Qt Memory manager
    By bunjee in forum Qt Programming
    Replies: 3
    Last Post: 19th August 2009, 17:43
  3. memory leak in QTableWidget
    By john_god in forum Qt Programming
    Replies: 4
    Last Post: 24th June 2009, 02:13
  4. Memory Requirements of Qt
    By Svaths in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 31st March 2007, 00:33
  5. Memory leak
    By vvbkumar in forum General Programming
    Replies: 4
    Last Post: 2nd September 2006, 15:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.