[Qt-interest] Problem with QAbstractTableModel and adding data
Mandeep Sandhu
mandeepsandhu.chd at gmail.com
Fri Aug 6 06:39:13 CEST 2010
> if ( inlist < m_maxNrMessages){
> beginInsertRows(topLeft,inlist+1,inlist+1);
beginInsertRows() rows expects the model index corresponding to the
parent of the new rows. Since you have a table model (which does not
have a valid parent), shouldn't you be passing an invalid model index
to beginInsertRows()?
Something like:
if ( inlist < m_maxNrMessages) {
beginInsertRows(QModelIndex(), inlist+1, inlist+1);
}
You can use topLeft index while emitting the dataChanged() signal, though.
HTH,
-mandeep
> }
> m_messages.push_front(remember);
> if ( m_messages.size() <= m_maxNrMessages){
> endInsertRows();
> }
>
> while (m_messages.size() > m_maxNrMessages){
> m_messages.pop_back();
> };
>
> QModelIndex botRight = createIndex(m_messages.size(),3);
> emit dataChanged(topLeft,botRight);
> }
>
>
> What am I missing here ?
>
> Rgds,
>
> David H
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
More information about the Qt-interest-old
mailing list