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:
parent
a62924f1d5
commit
645e73802a
|
@ -45,9 +45,9 @@ void CCatalogModel::onLanguageChanged()
|
||||||
|
|
||||||
void CCatalogModel::setModelData (CCatalog *pCatalog)
|
void CCatalogModel::setModelData (CCatalog *pCatalog)
|
||||||
{
|
{
|
||||||
reset();
|
beginResetModel();
|
||||||
m_pCatalog = pCatalog;
|
m_pCatalog = pCatalog;
|
||||||
reset();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CCatalogModel::columnCount (const QModelIndex& parent) const
|
int CCatalogModel::columnCount (const QModelIndex& parent) const
|
||||||
|
|
|
@ -45,16 +45,18 @@ void CChapterModel::onLanguageChanged()
|
||||||
|
|
||||||
void CChapterModel::clear()
|
void CChapterModel::clear()
|
||||||
{
|
{
|
||||||
|
beginResetModel();
|
||||||
m_listChapter.clear();
|
m_listChapter.clear();
|
||||||
m_pCatalog = 0;
|
m_pCatalog = 0;
|
||||||
reset();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CChapterModel::setModelData (CCatalog *pCatalog, QList<CChapter*> listChapter)
|
void CChapterModel::setModelData (CCatalog *pCatalog, QList<CChapter*> listChapter)
|
||||||
{
|
{
|
||||||
|
beginResetModel();
|
||||||
m_listChapter = listChapter;
|
m_listChapter = listChapter;
|
||||||
m_pCatalog = pCatalog;
|
m_pCatalog = pCatalog;
|
||||||
reset();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CChapterModel::columnCount (const QModelIndex & parent) const
|
int CChapterModel::columnCount (const QModelIndex & parent) const
|
||||||
|
|
|
@ -40,14 +40,16 @@ void CQuestionModel::onLanguageChanged()
|
||||||
|
|
||||||
void CQuestionModel::clear()
|
void CQuestionModel::clear()
|
||||||
{
|
{
|
||||||
|
beginResetModel();
|
||||||
m_pChapter=0;
|
m_pChapter=0;
|
||||||
reset();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CQuestionModel::setModelData (CChapter *pChapter)
|
void CQuestionModel::setModelData (CChapter *pChapter)
|
||||||
{
|
{
|
||||||
|
beginResetModel();
|
||||||
m_pChapter = pChapter;
|
m_pChapter = pChapter;
|
||||||
reset();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CQuestionModel::columnCount (const QModelIndex & parent) const
|
int CQuestionModel::columnCount (const QModelIndex & parent) const
|
||||||
|
|
Loading…
Reference in New Issue