fix: 修复全屏不能打开右键菜单问题

This commit is contained in:
hewenfei 2024-02-04 11:46:11 +08:00
parent 91819ccaef
commit f36b16229e
2 changed files with 4 additions and 4 deletions

View File

@ -92,8 +92,8 @@ ListView {
if (event.button === Qt.LeftButton) { if (event.button === Qt.LeftButton) {
// openApplication // openApplication
appManager.launchApp(id); appManager.launchApp(id);
} else if (mouse.button === Qt.RightButton) { } else if (event.button === Qt.RightButton) {
// appListView.model.openMenu(index, MenuInfo.FullScreen); menuManager.showMenu(model.id, MenuInfo.FullScreen);
} }
} }
} }

View File

@ -49,6 +49,7 @@ FavoriteContextMenu::actions(const DataEntity &data, QMenu *parent, const MenuIn
switch (location) { switch (location) {
case MenuInfo::AppList: case MenuInfo::AppList:
case MenuInfo::FullScreen:
case MenuInfo::FolderPage: { case MenuInfo::FolderPage: {
if (data.favorite() == 0) { if (data.favorite() == 0) {
list << new QAction(QObject::tr("Fix to favorite"), parent); list << new QAction(QObject::tr("Fix to favorite"), parent);
@ -79,7 +80,6 @@ FavoriteContextMenu::actions(const DataEntity &data, QMenu *parent, const MenuIn
appendActionsForAppsOutsideFolder(parent, data.id(), list); appendActionsForAppsOutsideFolder(parent, data.id(), list);
break; break;
} }
case MenuInfo::FullScreen:
case MenuInfo::Folder: { case MenuInfo::Folder: {
appendActionsForAppsInFolder(parent, data.id(), list); appendActionsForAppsInFolder(parent, data.id(), list);
break; break;
@ -115,7 +115,7 @@ void FavoriteContextMenu::appendActionsForAppsOutsideFolder(QObject *parent, con
for (auto folder : FavoriteFolderHelper::instance()->folderData()) { for (auto folder : FavoriteFolderHelper::instance()->folderData()) {
QString folderName = folder.getName(); QString folderName = folder.getName();
int folderId = folder.getId(); int folderId = folder.getId();
QAction *subAction = new QAction(QObject::tr("Add to ").append(folderName), parent); QAction *subAction = new QAction(QObject::tr("Add to \"%1\"").arg(folderName), parent);
QObject::connect(subAction, &QAction::triggered, parent, [appId, folderId] { QObject::connect(subAction, &QAction::triggered, parent, [appId, folderId] {
FavoritesModel::instance().addAppToFolder(appId, QString::number(folderId)); FavoritesModel::instance().addAppToFolder(appId, QString::number(folderId));
}); });