Repository navigation
fix(MenuItem): show gray background for parent item when submenu is open - #734
Conversation
Reviewer's GuideThe Qt6 menu implementation now distinguishes parent hover highlighting from the submenu-open state: hovered or pressed items use the active HighlightPanel, while a parent whose submenu is open but no longer hovered uses a theme-aware gray overlay. The PR also includes unrelated-looking Qt6 menu geometry/separator palette adjustments and Bloom checkbox asset updates that should be reviewed separately. State diagram for Qt6 menu item and submenu highlightingstateDiagram-v2
[*] --> ParentIdle
ParentIdle --> ParentHovered: hovered
ParentHovered --> ParentIdle: !hovered
ParentHovered --> SubmenuOpenHovered: subMenu.visible
SubmenuOpenHovered --> SubmenuOpenParent: !hovered
SubmenuOpenParent --> SubmenuOpenHovered: hovered
SubmenuOpenParent --> ParentIdle: !subMenu.visible
ParentHovered: HighlightPanel active color
SubmenuOpenHovered: HighlightPanel active color
SubmenuOpenParent: theme-aware gray overlay
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Hi @zqq-dora. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
… is open Log: fix parent menu item showing active highlight color instead of gray when submenu is open and mouse is not hovering the parent item Influence: parent menu items with open submenus now display gray background instead of active highlight color fix(MenuItem): 修复子菜单打开时一级菜单显示活动色而非灰色的问题 Log: 修复子菜单打开后鼠标移入子菜单时一级菜单仍显示活动高亮色的问题 Influence: 子菜单打开时一级菜单在未 hover 状态下显示灰色背景,而非活动高亮色
9f9003b to
60cb738
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, zqq-dora The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
54b1243
into
linuxdeepin:v25-flowstyle
Background
When a menu item has a submenu and the user moves the mouse into the submenu, the parent item was showing the active highlight color (HighlightPanel) instead of a subtle gray background. This was because
highlightedwas bound tohovered || (subMenu && subMenu.visible), keeping the item highlighted as long as the submenu was visible — regardless of whether the mouse was still on the parent item.Additionally, the
subMenuOpenedBackgroundpalette only defined anormal(light mode) value, leaving dark mode to fall back to the same black 15% overlay that is nearly invisible on a dark menu background. A separatesubmenuOpenedItemHighlightpalette with both light and dark values already existed in FlowStyle.qml but was unused.Changes
MenuItem.qml
highlightedbinding fromenabled && (hovered || (subMenu && subMenu.visible))toenabled && hovered, so the item is only highlighted while actually hovered.subMenuBackgroundColorfromDS.Style.menu.subMenuOpenedBackgroundtoDS.Style.menu.submenuOpenedItemHighlight, which has both light (rgba(0, 0, 0, 0.15)) and dark (rgba(1, 1, 1, 0.2)) values defined.Rectanglewhen!hovered && subMenu && subMenu.visible.HighlightPanel(active color) whendown || highlighted.Effect
Only the Qt6 (
qt6/src/qml/) implementation is changed; Qt5 is left unchanged as v25 ships Qt6 only.背景
当菜单项有子菜单时,用户将鼠标移入子菜单后,一级菜单项仍然显示活动高亮色(HighlightPanel),而非灰色背景。原因是
highlighted绑定为hovered || (subMenu && subMenu.visible),子菜单可见期间一级菜单始终处于高亮状态——无论鼠标是否还在一级菜单上。此外,
subMenuOpenedBackground调色板只定义了浅色模式(normal)的值,深色模式回退到同样的黑色 15% 叠加,在深色菜单背景上几乎不可见。FlowStyle.qml 中已存在submenuOpenedItemHighlight调色板,同时定义了浅色和深色值,但一直未被使用。改动
MenuItem.qml
highlighted绑定从enabled && (hovered || (subMenu && subMenu.visible))改为enabled && hovered,仅在鼠标 hover 时高亮。subMenuBackgroundColor从DS.Style.menu.subMenuOpenedBackground改为DS.Style.menu.submenuOpenedItemHighlight,后者同时定义了浅色(rgba(0, 0, 0, 0.15))和深色(rgba(1, 1, 1, 0.2))值。!hovered && subMenu && subMenu.visible时渲染灰色Rectangle。down || highlighted时渲染HighlightPanel(活动色)。效果
仅修改 Qt6(
qt6/src/qml/)实现,Qt5 保持不变,v25 仅使用 Qt6。Summary by Sourcery
Fix Qt6 menu item highlighting so parent items visibly transition to the appropriate submenu-open background when the pointer enters a submenu.
Bug Fixes:
Enhancements: