[Qt-interest] Problem with QAbstractTableModel and adding data

David Heremans david.heremans at intersoft-electronics.com
Fri Aug 6 09:16:46 CEST 2010


On 08/06/2010 06:39 AM, Mandeep Sandhu wrote:
>>    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);
> }
> 

Indeed, that solved my problem.

Thanks!

David H




More information about the Qt-interest-old mailing list