fix(issues:I9ITES):解决拖拽添加或右键添加到收藏区域,UI界面卡顿问题

This commit is contained in:
qiqi49 2024-08-26 15:15:12 +08:00 committed by iaom
parent 9ec99854d3
commit 9b9480eb83
1 changed files with 6 additions and 3 deletions

View File

@ -129,9 +129,12 @@ void AppFavoritesModel::updateFavoritesApps(const DataEntity &app, const QModelI
if (app.id().isEmpty()) {
return;
}
QPersistentModelIndex index(sourceIndex);
if (app.favorite() > 0 && !FavoriteFolderHelper::instance()->containApp(app.id())) {
QPersistentModelIndex index(sourceIndex);
if (m_favoritesApps.contains(index)) {
return;
}
addFavoriteApp(index);
FavoritesConfig::instance().insertValue(APP_ID_SCHEME + index.data(DataEntity::Id).toString());
@ -139,8 +142,6 @@ void AppFavoritesModel::updateFavoritesApps(const DataEntity &app, const QModelI
if (FavoriteFolderHelper::instance()->containApp(app.id())) {
FavoriteFolderHelper::instance()->removeAppFromFolder(app.id());
}
QPersistentModelIndex index(sourceIndex);
removeFavoriteApp(index);
}
}
@ -365,6 +366,8 @@ void AppFavoritesModel::addAppToFavorites(const QString &id, const int &index)
if (id.isEmpty()) {
return;
}
QPersistentModelIndex modelIndex(m_sourceModel->index(m_sourceModel->indexOfApp(id)));
addFavoriteApp(modelIndex);
m_sourceModel->databaseInterface()->fixAppToFavorite(id, 1);