Results 1 to 1 of 1

Thread: QTableView with custom QAbstractTableModel but how !?

  1. #1
    Join Date
    Mar 2011
    Posts
    45
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView with custom QAbstractTableModel but how !?

    hello folks,

    i am writing an application which uses a QTableView for displaying data
    and i have the problem of having huge amount of data to be inserted into my QTableView (several hundred-thousand rows).

    i found within this forum the following post (quite old from 2006):

    http://www.qtcentre.org/threads/2888...ms-in-treeview

    As proposed within the posting i implemented my custom QAbstractTableModel.
    But now comes the part which i dont understand:

    the documentation sais one does not need to overwrite QAbstractTableModel::setData(..) if data is read-only:

    http://doc.qt.nokia.com/4.7/qabstrac...l.html#details

    but how is data then inserted into the model !?!? the posting from above also had the initial problem of setData(..) being slow and the custom made model also ends up having no setData(..) (see post), but how is insertion into the model then done for custom made models without using setData(..) and also for huge amount of data!?!?

    the posting even reports that inserting 300.000 rows took less then 1 sec., which seems impossible to me.

    how is this possible and what did i miss?
    thnx.


    Added after 15 minutes:


    ok, i was too fast (again) by posting my problem:

    its indeed not necessary to implement setData(..) when no editing is needed.
    if the model subclassed from QAbstractTableModel should lets say have a data construct of the
    form std::vector<std::string>, then one can populate the appropriate member in the constructor of
    the custom-model and displaying it even does not take a second.
    thnx anyway (solved that on my own).
    cheers.
    Last edited by kerim; 5th April 2011 at 16:51.

Similar Threads

  1. Custom role in custom QAbstractTableModel
    By hailflex in forum Newbie
    Replies: 3
    Last Post: 10th December 2009, 12:09
  2. Replies: 4
    Last Post: 6th May 2009, 08:18
  3. QAbstractTableModel , custom data
    By akon in forum Newbie
    Replies: 0
    Last Post: 17th April 2009, 16:03
  4. Performance with QTableView and QAbstractTableModel
    By MBex in forum Qt Programming
    Replies: 3
    Last Post: 25th February 2009, 08:04
  5. Replies: 3
    Last Post: 29th January 2009, 08:38

Tags for this Thread

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.