forked from qt-creator/qt-creator
Do not use QAbstractItemModel::reset().
Change-Id: Ie49bdf576a6d3543aef6df133b27c8827775c935
Rationale:
a) It is conceptually cleaner to do the changes to the model
in between calls to beginResetModel() and endResetModel,
respectively.
b) The function is deprecated in Qt 5, for exactly that reason.
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -49,9 +49,10 @@ void SourceFilesHandler::clearModel()
|
||||
{
|
||||
if (m_shortNames.isEmpty())
|
||||
return;
|
||||
beginResetModel();
|
||||
m_shortNames.clear();
|
||||
m_fullNames.clear();
|
||||
reset();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
QVariant SourceFilesHandler::headerData(int section,
|
||||
@@ -101,6 +102,7 @@ QVariant SourceFilesHandler::data(const QModelIndex &index, int role) const
|
||||
|
||||
void SourceFilesHandler::setSourceFiles(const QMap<QString, QString> &sourceFiles)
|
||||
{
|
||||
beginResetModel();
|
||||
m_shortNames.clear();
|
||||
m_fullNames.clear();
|
||||
QMap<QString, QString>::ConstIterator it = sourceFiles.begin();
|
||||
@@ -109,7 +111,7 @@ void SourceFilesHandler::setSourceFiles(const QMap<QString, QString> &sourceFile
|
||||
m_shortNames.append(it.key());
|
||||
m_fullNames.append(it.value());
|
||||
}
|
||||
reset();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void SourceFilesHandler::removeAll()
|
||||
|
||||
Reference in New Issue
Block a user