From 258bf0b8a150e5cb79df0fb5cbcd5be76d144849 Mon Sep 17 00:00:00 2001 From: Gong Heng Date: Thu, 20 Jun 2024 10:17:44 +0800 Subject: [PATCH] fix: [desktop] When the content menu pops up, the input method can still be used. 1. When the wayland menu pops up, there is no focus on seizing, causing the input method to not disappear. 2. In the Wayland mode, when the menu pops up, the input method is disabled Log: fix issue Bug: https://pms.uniontech.com/bug-view-259639.html --- src/plugins/desktop/core/ddplugin-canvas/view/canvasview.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/desktop/core/ddplugin-canvas/view/canvasview.cpp b/src/plugins/desktop/core/ddplugin-canvas/view/canvasview.cpp index b39367ba00..a4c80c7a28 100644 --- a/src/plugins/desktop/core/ddplugin-canvas/view/canvasview.cpp +++ b/src/plugins/desktop/core/ddplugin-canvas/view/canvasview.cpp @@ -349,6 +349,8 @@ void CanvasView::contextMenuEvent(QContextMenuEvent *event) bool isEmptyArea = !index.isValid(); Qt::ItemFlags flags; + if (WindowUtils::isWayLand()) + setAttribute(Qt::WA_InputMethodEnabled, false); if (isEmptyArea) { d->menuProxy->showEmptyAreaMenu(flags, gridPos); } else { @@ -359,6 +361,8 @@ void CanvasView::contextMenuEvent(QContextMenuEvent *event) flags = model()->flags(index); d->menuProxy->showNormalMenu(index, flags, gridPos); } + if (WindowUtils::isWayLand()) + setAttribute(Qt::WA_InputMethodEnabled, true); } void CanvasView::startDrag(Qt::DropActions supportedActions)