From aab6e6e104059cdaa4f40d61620b8172b927db6b Mon Sep 17 00:00:00 2001 From: yeshanshan Date: Thu, 3 Dec 2026 13:01:55 +0800 Subject: [PATCH] fix: prevent disabled menu items from highlighting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Add enabled check to highlighted property so disabled menu items never enter highlighted state 2. Update textColor binding to only use highlighted text color when the control is both enabled and highlighted 3. Gate the highlight panel Loader activation on enabled state to avoid rendering hover visuals for disabled items Influence: 1. Open a menu containing both enabled and disabled items and verify disabled items do not highlight on hover 2. Verify enabled items still highlight correctly on hover and when their submenu is visible 3. Check that disabled item text remains in the normal (non-highlighted) color when hovered 4. Confirm no highlight panel renders behind disabled items during hover 5. Test submenu open/close behavior on enabled items is unaffected 6. Verify opacity for disabled items stays consistent at 0.4 fix: 禁止禁用状态的菜单项显示高亮 1. 在 highlighted 属性中加入 enabled 判断,确保禁用的菜单项不会进入高亮 状态 2. 更新 textColor 绑定,仅在控件同时处于启用和高亮状态时使用高亮文字颜色 3. 高亮面板 Loader 的激活条件加入 enabled 判断,避免为禁用项渲染悬停视觉 效果 Influence: 1. 打开包含启用和禁用项的菜单,验证禁用项悬停时不高亮 2. 验证启用项在悬停及子菜单可见时仍能正确高亮 3. 检查禁用项文字在悬停时保持普通(非高亮)颜色 4. 确认禁用项悬停时不会渲染高亮面板 5. 测试启用项的子菜单打开/关闭行为不受影响 6. 验证禁用项透明度保持为 0.4 Log: Fixed disabled menu items incorrectly showing highlight on hover PMS: BUG-380835 --- qt6/src/qml/MenuItem.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qt6/src/qml/MenuItem.qml b/qt6/src/qml/MenuItem.qml index ed61474af..d2c6b755a 100644 --- a/qt6/src/qml/MenuItem.qml +++ b/qt6/src/qml/MenuItem.qml @@ -17,14 +17,14 @@ T.MenuItem { padding: DS.Style.control.padding spacing: DS.Style.control.spacing opacity: D.ColorSelector.controlState === D.DTK.DisabledState ? 0.4 : 1 - highlighted: hovered || (subMenu && subMenu.visible) + highlighted: enabled && (hovered || (subMenu && subMenu.visible)) icon { height: DS.Style.menu.item.iconSize.height width: DS.Style.menu.item.iconSize.height } - property D.Palette textColor: control.highlighted ? DS.Style.checkedButton.text - : DS.Style.menu.itemText + property D.Palette textColor: control.enabled && control.highlighted + ? DS.Style.checkedButton.text : DS.Style.menu.itemText property D.Palette subMenuBackgroundColor: DS.Style.menu.subMenuOpenedBackground palette.windowText: D.ColorSelector.textColor @@ -104,7 +104,7 @@ T.MenuItem { implicitHeight: DS.Style.menu.item.height Loader { anchors.fill: parent - active: control.highlighted + active: control.enabled && control.highlighted sourceComponent: HighlightPanel { outerShadowColor: null innerShadowColor: null