qt5 conv: replace reset() for models

In qt5 reset() is no longer available for models, instead one should
call beginResetModel(), then reset the model data and then call
endResetModel().

See https://doc.qt.io/qt-5/qabstractitemmodel-obsolete.html#reset
This commit is contained in:
Sebastian Lohff 2022-06-30 23:19:57 +02:00
parent a62924f1d5
commit 645e73802a
3 changed files with 10 additions and 6 deletions

View File

@ -45,9 +45,9 @@ void CCatalogModel::onLanguageChanged()
void CCatalogModel::setModelData (CCatalog *pCatalog)
{
reset();
beginResetModel();
m_pCatalog = pCatalog;
reset();
endResetModel();
}
int CCatalogModel::columnCount (const QModelIndex& parent) const

View File

@ -45,16 +45,18 @@ void CChapterModel::onLanguageChanged()
void CChapterModel::clear()
{
beginResetModel();
m_listChapter.clear();
m_pCatalog = 0;
reset();
endResetModel();
}
void CChapterModel::setModelData (CCatalog *pCatalog, QList<CChapter*> listChapter)
{
beginResetModel();
m_listChapter = listChapter;
m_pCatalog = pCatalog;
reset();
endResetModel();
}
int CChapterModel::columnCount (const QModelIndex & parent) const

View File

@ -40,14 +40,16 @@ void CQuestionModel::onLanguageChanged()
void CQuestionModel::clear()
{
beginResetModel();
m_pChapter=0;
reset();
endResetModel();
}
void CQuestionModel::setModelData (CChapter *pChapter)
{
beginResetModel();
m_pChapter = pChapter;
reset();
endResetModel();
}
int CQuestionModel::columnCount (const QModelIndex & parent) const