From 8d8d12fc43758fce6875637d71f6d751bdf0e633 Mon Sep 17 00:00:00 2001 From: zhangkun2 Date: Tue, 15 Sep 2026 19:28:48 +0800 Subject: [PATCH] fix: enable window popup type for Menu and Popup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Root cause: Menu.qml and Popup.qml did not set popupType, Qt defaulted to Popup.Item which renders inside parent window and gets clipped at window boundaries 2. Fix: set popupType: T.Popup.Window to activate the existing Window mode infrastructure from PR #615 (edge avoidance, focus management, outside-click dismissal) 3. Impact: all DTK Menu and Popup components now render as top-level windows, menus near screen edges display correctly Log: fix menu and popup being clipped by window boundaries Influence: 1. Test menu display near window/screen edges 2. Test popup display near window/screen edges 3. Verify menu focus management and outside-click dismissal 4. Verify no regression on existing menu and popup usage fix: 启用 Menu 和 Popup 的窗口弹出模式 1. 根因:Menu.qml 和 Popup.qml 未设置 popupType,Qt 默认使用 Popup.Item 在父窗口内渲染,被窗口边界裁切无法超窗口显示 2. 方案:设置 popupType: T.Popup.Window 激活 PR #615 已实现的 窗口模式基础设施(屏幕边缘避让、焦点管理、窗口外点击关闭) 3. 影响:所有 DTK Menu 和 Popup 组件切换为顶层窗口弹出, 屏幕边缘附近菜单正常显示 Log: 修复菜单和弹出框被窗口边界裁切的问题 Influence: 1. 测试窗口/屏幕边缘附近的菜单显示 2. 测试窗口/屏幕边缘附近的弹出框显示 3. 验证菜单焦点管理和窗口外点击关闭功能 4. 验证现有菜单和弹出框使用场景无回归 PMS: BUG-280627 --- qt6/src/qml/Menu.qml | 1 + qt6/src/qml/Popup.qml | 1 + 2 files changed, 2 insertions(+) diff --git a/qt6/src/qml/Menu.qml b/qt6/src/qml/Menu.qml index b3a07729b..56dd306e5 100644 --- a/qt6/src/qml/Menu.qml +++ b/qt6/src/qml/Menu.qml @@ -11,6 +11,7 @@ import org.deepin.dtk.style 1.0 as DS T.Menu { id: control + popupType: T.Popup.Window property bool closeOnInactive: true property int maxVisibleItems : DS.Style.arrowListView.maxVisibleItems diff --git a/qt6/src/qml/Popup.qml b/qt6/src/qml/Popup.qml index 6b8613332..1a7ff89e0 100644 --- a/qt6/src/qml/Popup.qml +++ b/qt6/src/qml/Popup.qml @@ -10,6 +10,7 @@ import org.deepin.dtk.style 1.0 as DS T.Popup { id: control + popupType: T.Popup.Window palette: D.DTK.palette focus: popupType === Popup.Window