Commit 5edc15e
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-3049911 parent 1998e42 commit 5edc15e
1 file changed
Lines changed: 81 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| |||
165 | 168 | | |
166 | 169 | | |
167 | 170 | | |
| 171 | + | |
168 | 172 | | |
169 | 173 | | |
170 | 174 | | |
171 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
172 | 182 | | |
173 | 183 | | |
| 184 | + | |
174 | 185 | | |
175 | 186 | | |
176 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
177 | 190 | | |
178 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
179 | 258 | | |
180 | 259 | | |
181 | 260 | | |
| |||
0 commit comments