Results 1 to 3 of 3

Thread: Need help with QTableView/QTableWidget and large data

  1. #1
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Need help with QTableView/QTableWidget and large data

    Hi, i'm writing an emulator frontend, so i need handle with large amounts of data ( MAME romset is 10000+ files ).
    The rom listing part need to be fast, fill a table with 10000+ rows and 5 or 6 columns. I've seen some frontends doing this almost intantly.
    i've tried some like:
    for(0-15000) {
    addrow;
    read a line from game list file (text)
    additems of each column;
    }

    but its little slow, 3-5 seconds, nothing to do against that "instantly listing frontends".
    i'm no sure if its a problem of my method, or it's not possible do this almost instantly with Qt, or if i must use QLIstView/Model instead of QTableWidget...
    i'm a novice autodidact programmer, so beg for some help.
    Thanks!

    PD: sorry for my english

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Need help with QTableView/QTableWidget and large data

    The way long lists are generally handled is called lazy loading. Only the small number of rows of data needed to draw what is visible is loaded at initial display. As the user scrolls down the list more rows are loaded to cover what is displayed. QSqlTableModel does this sort of thing, loading only the first 255 rows until such time as later rows are requested. Often is possible to ensure the items most likely to be required are in the first batch fetched or a filter mechanism is used to shorten the list... the user never scrolls and the other rows are never fetched.

  3. #3
    Join Date
    Jan 2012
    Location
    Canary Islands, Spain
    Posts
    86
    Thanks
    4
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Need help with QTableView/QTableWidget and large data

    Seems a good idea, i never noticed about that, thanks!!
    i'll try it.

    after some investigation, it's seems QTableView does lazy loading automatically, is this true?
    Last edited by aguayro; 29th June 2012 at 12:23.

Similar Threads

  1. Replies: 1
    Last Post: 1st July 2011, 13:03
  2. Replies: 1
    Last Post: 26th November 2010, 12:06
  3. Replies: 0
    Last Post: 11th August 2010, 19:00
  4. qtablewidget and qtableview
    By dreamer in forum Qt Programming
    Replies: 1
    Last Post: 17th May 2008, 16:01
  5. QTableView versus QTableWidget
    By jcr in forum Qt Programming
    Replies: 2
    Last Post: 24th May 2006, 19:51

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.