forked from qt-creator/qt-creator
QmlDesigner: Update content library models when visibility change
...instead of resetting the model. This prevents downloading materials and textures from getting interrupted and is more efficient performance-wise. Fixes: QDS-9654 Change-Id: Id15a86c43ba06aa07071229259b9ea163979b619 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -332,14 +332,14 @@ void ContentLibraryMaterialsModel::setSearchText(const QString &searchText)
|
||||
|
||||
m_searchText = lowerSearchText;
|
||||
|
||||
bool catVisibilityChanged = false;
|
||||
for (ContentLibraryMaterialsCategory *cat : std::as_const(m_bundleCategories))
|
||||
catVisibilityChanged |= cat->filter(m_searchText);
|
||||
for (int i = 0; i < m_bundleCategories.size(); ++i) {
|
||||
ContentLibraryMaterialsCategory *cat = m_bundleCategories.at(i);
|
||||
bool catVisibilityChanged = cat->filter(m_searchText);
|
||||
if (catVisibilityChanged)
|
||||
emit dataChanged(index(i), index(i), {roleNames().keys("bundleCategoryVisible")});
|
||||
}
|
||||
|
||||
updateIsEmpty();
|
||||
|
||||
if (catVisibilityChanged)
|
||||
resetModel();
|
||||
}
|
||||
|
||||
void ContentLibraryMaterialsModel::updateImportedState(const QStringList &importedMats)
|
||||
|
@@ -225,15 +225,14 @@ void ContentLibraryTexturesModel::setSearchText(const QString &searchText)
|
||||
|
||||
m_searchText = lowerSearchText;
|
||||
|
||||
bool catVisibilityChanged = false;
|
||||
|
||||
for (ContentLibraryTexturesCategory *cat : std::as_const(m_bundleCategories))
|
||||
catVisibilityChanged |= cat->filter(m_searchText);
|
||||
for (int i = 0; i < m_bundleCategories.size(); ++i) {
|
||||
ContentLibraryTexturesCategory *cat = m_bundleCategories.at(i);
|
||||
bool catVisibilityChanged = cat->filter(m_searchText);
|
||||
if (catVisibilityChanged)
|
||||
emit dataChanged(index(i), index(i), {roleNames().keys("bundleCategoryVisible")});
|
||||
}
|
||||
|
||||
updateIsEmpty();
|
||||
|
||||
if (catVisibilityChanged)
|
||||
resetModel();
|
||||
}
|
||||
|
||||
void ContentLibraryTexturesModel::resetModel()
|
||||
|
Reference in New Issue
Block a user