Results 1 to 4 of 4

Thread: rowCount and model

  1. #1
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default rowCount and model

    Hi,

    I'm getting more confused about custom models. I derive from QAbstractTableModel and thus implement the rowCount method. Now this returns obviously the amount of rows, but how do you dynamically change this?

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: rowCount and model

    Don't you have a member in your model that holds the current number of rows?

  3. #3
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: rowCount and model

    Sorry Marcel, I've worded this wrong.

    I have a QList<> in the model class which holds the data for the table, I return the amount of items in this list to reflect the rowcount, but alas, the amount of rows in the table still doesn't change. I must be missing something, but don't know what?

    Qt Code:
    1. int DATreeModel::rowCount( const QModelIndex& parent ) const
    2. {
    3. return m_Data.count();
    4. }
    To copy to clipboard, switch view to plain text mode 

    m_Data is the QList which gets appended to perodically.

    Kind regards,
    Steve

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: rowCount and model

    Do you inform the model interface and its environment through emitting signals upon inserting new items into the list?

    Double thread: http://www.qtcentre.org/forum/f-newb...king-6960.html
    Last edited by wysota; 11th May 2007 at 10:54.

Similar Threads

  1. one model for several viewings
    By someralex in forum Qt Programming
    Replies: 19
    Last Post: 15th December 2006, 22:52
  2. Huge tableview low performance
    By semoser in forum Qt Programming
    Replies: 9
    Last Post: 9th November 2006, 18:58
  3. Limitation when adding more than 256 items to a model
    By darkadept in forum Qt Programming
    Replies: 5
    Last Post: 25th May 2006, 16:26

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.