Hi there
I've a QListViewwith a model derived from QAbstractListModel.
In the model I want to insert some rows:
bool MembersListModel
::insertRows(int row,
int count,
const QModelIndex & parent
/*= QModelIndex()*/) { beginInsertRows(parent, row, row + count);
Q_ASSERT(m_lstTempAditionalProdData->count() == count);
for(int i=0; i<count; i++) {
Q_ASSERT(i < m_lstTempAditionalProdData->count());
m_lstProdDataForModel->insert(row+i, m_lstTempAditionalProdData->at(i));
}
endInsertRows();
return true;
}
bool MembersListModel::insertRows(int row, int count, const QModelIndex & parent /*= QModelIndex()*/) {
beginInsertRows(parent, row, row + count);
Q_ASSERT(m_lstTempAditionalProdData->count() == count);
for(int i=0; i<count; i++) {
Q_ASSERT(i < m_lstTempAditionalProdData->count());
m_lstProdDataForModel->insert(row+i, m_lstTempAditionalProdData->at(i));
}
endInsertRows();
return true;
}
To copy to clipboard, switch view to plain text mode
If I insert the rows the view always scrolls to the begining of the list. I can't figure out what's hapening...
Any hints?
Thanks Luke
Bookmarks