View Full Version : rowCount and model
steg90
11th May 2007, 08:52
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?
marcel
11th May 2007, 08:58
Don't you have a member in your model that holds the current number of rows?
steg90
11th May 2007, 09:04
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?
int DATreeModel::rowCount( const QModelIndex& parent ) const
{
return m_Data.count();
}
m_Data is the QList which gets appended to perodically.
Kind regards,
Steve
wysota
11th May 2007, 09:14
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-newbie-4/t-begininsertrows-doesnt-appear-to-be-working-6960.html
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.