Commit 42dda9f
committed
fix(ComboBox): fix the issue of highlighted state lingering after
mouse leaves menu items
Root cause: The delegate.highlighted is bound to
control.highlightedIndex (read-only).
When the mouse leaves the popup area, this value is not automatically
reset, causing the highlighted state to persist.
Fix approach:
- Add a new contentHovered property to the popup to track whether
the mouse is within the popup list area
- Use HoverHandler in Qt6 to synchronize the contentHovered state
- Use MouseArea (acceptedButtons: Qt.NoButton) in Qt5 to synchronize
the contentHovered state
- Change delegate.highlighted to popup.contentHovered &&
control.highlightedIndex === index
Log: Fixed the issue of lingering highlight on ComboBox menu items after mouse leaves
Influence: ComboBox menu items
fix(ComboBox): 修复菜单项鼠标离开后高亮残留问题
根因:delegate.highlighted 绑定 control.highlightedIndex(只读),
鼠标离开弹出区域时该值不会自动重置,导致高亮状态持续残留。
修复方案:
- 为 popup 新增 contentHovered 属性,追踪鼠标是否在弹出列表区域内
- Qt6 版本使用 HoverHandler 同步 contentHovered 状态
- Qt5 版本使用 MouseArea(acceptedButtons: Qt.NoButton)同步 contentHovered 状态
- 将 delegate.highlighted 改为 popup.contentHovered && control.highlightedIndex === index
Log: 修复ComboBox的菜单项鼠标离开后高亮残留问题
Influence: ComboBox菜单项
PMS: BUG-3066831 parent 1998e42 commit 42dda9f
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
179 | 183 | | |
180 | 184 | | |
181 | 185 | | |
| |||
0 commit comments