-
Notifications
You must be signed in to change notification settings - Fork 143
fix(bluetooth): fix send file button not showing due to stale state #2983
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.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: caixr23, ComixHe 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 |
Replace dynamic menu item insertion with visible property binding to ensure UI updates immediately when connection status changes. Log: fix send file button not showing due to stale state Pms: BUG-311737 Signed-off-by: ComixHe <heyuming@deepin.org>
deepin pr auto review这段代码的修改主要是对蓝牙设备列表中"发送文件"菜单项的显示/隐藏逻辑进行了重构。以下是对该代码变更的详细审查和改进建议: 1. 代码逻辑改进优点:
潜在问题:
2. 性能优化建议:
readonly property bool showSendFile: model.canSendFile && model.connectStatus === BlueToothModel.Connected3. 代码安全建议:
4. 代码质量建议:
5. 改进后的代码示例D.ItemDelegate {
id: itemCtl
readonly property bool showSendFile: model ? (model.canSendFile && model.connectStatus === BlueToothModel.Connected) : false
// ... 其他属性 ...
D.Menu {
id: contextMenu
D.MenuItem {
id: sendFileItem
padding: 0
text: qsTr("Send Files")
visible: itemCtl.showSendFile
height: visible ? implicitHeight : 0
implicitHeight: visible ? undefined : 0
topPadding: visible ? undefined : 0
bottomPadding: visible ? undefined : 0
onTriggered: {
fileDlg.open()
}
}
// ... 其他菜单项 ...
}
}总结这次修改总体上是积极的,简化了代码逻辑并解决了可见性问题。主要改进方向是:
|
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Replace dynamic menu item insertion with visible property binding to ensure UI updates immediately when connection status changes.
Log: fix send file button not showing due to stale state
Pms: BUG-311737