forked from qt-creator/qt-creator
Do not call endResetModel twice
Moved beginResetModel/endResetModel calls out of ItemLibrary::updateVisibility into the calling functions. This way endResetModel is not called twice in ItemLibraryModel::update. Change-Id: I9588ba97aeb9da7c5a629612c9b3dc6315859501 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -234,8 +234,11 @@ void ItemLibraryModel::showAllHiddenCategories()
|
|||||||
void ItemLibraryModel::setFlowMode(bool b)
|
void ItemLibraryModel::setFlowMode(bool b)
|
||||||
{
|
{
|
||||||
m_flowMode = b;
|
m_flowMode = b;
|
||||||
bool changed;
|
bool changed = false;
|
||||||
updateVisibility(&changed);
|
if (updateVisibility(&changed); changed) {
|
||||||
|
beginResetModel();
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemLibraryModel::ItemLibraryModel(QObject *parent)
|
ItemLibraryModel::ItemLibraryModel(QObject *parent)
|
||||||
@@ -308,7 +311,10 @@ void ItemLibraryModel::setSearchText(const QString &searchText)
|
|||||||
m_searchText = lowerSearchText;
|
m_searchText = lowerSearchText;
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
updateVisibility(&changed);
|
if (updateVisibility(&changed); changed) {
|
||||||
|
beginResetModel();
|
||||||
|
endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
selectImportFirstVisibleCategory();
|
selectImportFirstVisibleCategory();
|
||||||
}
|
}
|
||||||
@@ -592,11 +598,6 @@ void ItemLibraryModel::updateVisibility(bool *changed)
|
|||||||
if (!m_searchText.isEmpty() && hasVisibleItems && !import->importExpanded())
|
if (!m_searchText.isEmpty() && hasVisibleItems && !import->importExpanded())
|
||||||
import->setImportExpanded();
|
import->setImportExpanded();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
|
||||||
beginResetModel();
|
|
||||||
endResetModel();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemLibraryModel::addRoleNames()
|
void ItemLibraryModel::addRoleNames()
|
||||||
|
Reference in New Issue
Block a user