-
Notifications
You must be signed in to change notification settings - Fork 45
fix: Fix the issue where removing an item from the dropdown list does not cancel the highlight #563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @pengfeixx, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
qt6/src/qml/ComboBox.qml
Outdated
| } | ||
| } | ||
|
|
||
| ArrowListView { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里Item用的是MenuItem,是不是应该从MenuItem里去做这种颜色的变化呀,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里Item用的是MenuItem,是不是应该从MenuItem里去做这种颜色的变化呀,
高亮还是在menuitem里处理的,但是捕获鼠标移入移出还是要在外面listview里来做
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx 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 |
qt6/src/qml/ComboBox.qml
Outdated
| text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : (model[control.textRole] === undefined ? modelData[control.textRole] : model[control.textRole])) : modelData | ||
| icon.name: (control.iconNameRole && model[control.iconNameRole] !== undefined) ? model[control.iconNameRole] : null | ||
| highlighted: control.highlightedIndex === index | ||
| highlightEnabled: arrowListView.hovered || (control.highlightedIndex === index && subMenu && subMenu.visible) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那还需要这个highlightEnabled么?能直接用highlight么,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那还需要这个highlightEnabled么?能直接用highlight么,
已修改
qt6/src/qml/ArrowListView.qml
Outdated
| HoverHandler { | ||
| target: itemsView | ||
| onHoveredChanged: { | ||
| control.hovered = hovered |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这种应该可以直接绑定,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这种应该可以直接绑定,
已修改
… not cancel the highlight
Fix the issue where removing an item from the dropdown list does not cancel the highlight
Log: Fix the issue where removing an item from the dropdown list does not cancel the highlight
pms: BUG-306683
BUG-304991
deepin pr auto review这份代码审查主要针对提供的git diff,对ArrowListView.qml、ComboBox.qml和Menu.qml三个文件的修改进行分析。 总体评价这段代码的目的是增强ComboBox和Menu组件的交互体验,主要是通过引入 详细审查1. 语法与逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进建议
总结这段代码逻辑清晰,能够有效解决ComboBox和Menu在鼠标交互时的状态保持问题。主要改进点在于减少中间变量、注意组件间的耦合度以及确认HoverHandler的目标范围。代码安全性方面做得较好,有空指针检查。性能方面对于常规UI场景没有问题。 |
| text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : (model[control.textRole] === undefined ? modelData[control.textRole] : model[control.textRole])) : modelData | ||
| icon.name: (control.iconNameRole && model[control.iconNameRole] !== undefined) ? model[control.iconNameRole] : null | ||
| highlighted: control.highlightedIndex === index | ||
| highlighted: (control.highlightedIndex === index) && (arrowListView.hovered || (subMenu && subMenu.visible)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在外面不要访问contentItem里的arrowListView,因为contentItem可能被外面复写,
| text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : (model[control.textRole] === undefined ? modelData[control.textRole] : model[control.textRole])) : modelData | ||
| icon.name: (control.iconNameRole && model[control.iconNameRole] !== undefined) ? model[control.iconNameRole] : null | ||
| highlighted: control.highlightedIndex === index | ||
| highlighted: (control.highlightedIndex === index) && (arrowListView.hovered || (subMenu && subMenu.visible)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能不能只去判断MenuItem的hover呀,而不是通过外面的那个Popup有没有hover去判断,因为现在Popup可能存在margin,这样的话,在hover时,MenuItem也应该失去highlight的,不显示background,
| } | ||
|
|
||
| if (!hasOpenSubMenu) { | ||
| control.currentIndex = -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能不修改currentIndex么,因为currentIndex是对外暴露的,外面可能监听了这个属性,如果我们改变了currentIndex,会导致调用方的业务逻辑发生变化,
|
TAG Bot New tag: 6.7.33 |
Fix the issue where removing an item from the dropdown list does not cancel the highlight
Log: Fix the issue where removing an item from the dropdown list does not cancel the highlight
pms: BUG-306683
BUG-304991