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;
|
m_searchText = lowerSearchText;
|
||||||
|
|
||||||
bool catVisibilityChanged = false;
|
for (int i = 0; i < m_bundleCategories.size(); ++i) {
|
||||||
for (ContentLibraryMaterialsCategory *cat : std::as_const(m_bundleCategories))
|
ContentLibraryMaterialsCategory *cat = m_bundleCategories.at(i);
|
||||||
catVisibilityChanged |= cat->filter(m_searchText);
|
bool catVisibilityChanged = cat->filter(m_searchText);
|
||||||
|
if (catVisibilityChanged)
|
||||||
|
emit dataChanged(index(i), index(i), {roleNames().keys("bundleCategoryVisible")});
|
||||||
|
}
|
||||||
|
|
||||||
updateIsEmpty();
|
updateIsEmpty();
|
||||||
|
|
||||||
if (catVisibilityChanged)
|
|
||||||
resetModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentLibraryMaterialsModel::updateImportedState(const QStringList &importedMats)
|
void ContentLibraryMaterialsModel::updateImportedState(const QStringList &importedMats)
|
||||||
|
@@ -225,15 +225,14 @@ void ContentLibraryTexturesModel::setSearchText(const QString &searchText)
|
|||||||
|
|
||||||
m_searchText = lowerSearchText;
|
m_searchText = lowerSearchText;
|
||||||
|
|
||||||
bool catVisibilityChanged = false;
|
for (int i = 0; i < m_bundleCategories.size(); ++i) {
|
||||||
|
ContentLibraryTexturesCategory *cat = m_bundleCategories.at(i);
|
||||||
for (ContentLibraryTexturesCategory *cat : std::as_const(m_bundleCategories))
|
bool catVisibilityChanged = cat->filter(m_searchText);
|
||||||
catVisibilityChanged |= cat->filter(m_searchText);
|
if (catVisibilityChanged)
|
||||||
|
emit dataChanged(index(i), index(i), {roleNames().keys("bundleCategoryVisible")});
|
||||||
|
}
|
||||||
|
|
||||||
updateIsEmpty();
|
updateIsEmpty();
|
||||||
|
|
||||||
if (catVisibilityChanged)
|
|
||||||
resetModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentLibraryTexturesModel::resetModel()
|
void ContentLibraryTexturesModel::resetModel()
|
||||||
|
Reference in New Issue
Block a user