woodtluk
8th October 2010, 15:19
Hi there
I've a QListView with 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;
}
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
I've a QListView with 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;
}
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