-
Notifications
You must be signed in to change notification settings - Fork 50
fix: fix MTU input formatting and change detection #423
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
Fixed MTU spinbox locale issue that caused incorrect number formatting with thousand separators. Changed from custom text formatter to using C locale which doesn't include number grouping. Added displayTextChanged handler to properly detect when MTU value changes and trigger edit state. This ensures consistent number display and reliable change detection. Log: Fixed MTU input field formatting and change detection Influence: 1. Test MTU input field displays numbers without thousand separators 2. Verify MTU value changes are properly detected when editing 3. Check that edit state is triggered correctly on MTU modifications 4. Test with various MTU values including edge cases (min/max values) 5. Verify console warnings appear when MTU values are changed fix: 修复MTU输入格式化和变更检测问题 修复了MTU微调框的区域设置问题,该问题导致数字格式错误显示千位分隔 符。从自定义文本格式化器改为使用不包含数字分组的C区域设置。添加了 displayTextChanged处理程序以正确检测MTU值变化并触发编辑状态。这确保了数 字显示的一致性和变更检测的可靠性。 Log: 修复MTU输入字段格式化和变更检测问题 Influence: 1. 测试MTU输入字段显示数字时不带千位分隔符 2. 验证编辑时MTU值变化能被正确检测 3. 检查MTU修改时编辑状态是否正确触发 4. 测试各种MTU值,包括边界情况(最小/最大值) 5. 验证MTU值更改时控制台警告是否出现 PMS: BUG-338289
Reviewer's guide (collapsed on small PRs)Reviewer's GuideReplaced custom MTU spinbox formatter with the C locale to eliminate thousand separators and added a displayTextChanged handler to detect MTU edits and trigger the component’s edit state reliably. Sequence diagram for MTU value change detection and edit state triggeringsequenceDiagram
participant User as actor User
participant "MTU SpinBox"
participant "Root Component"
User->>"MTU SpinBox": Edit MTU value
"MTU SpinBox"->>"MTU SpinBox": displayTextChanged event
"MTU SpinBox"->>"Root Component": Call editClicked() if value changed
"Root Component"->>"Root Component": Enter edit state
"MTU SpinBox"->>"Root Component": Log warning if MTU value changed
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review我来对这个代码变更进行审查:
潜在问题:
改进建议:
onDisplayTextChanged: {
if (hasMTU) {
const cleanDisplayText = displayText.replace(/,/g, "")
if (root.config.mtu !== value || cleanDisplayText !== value.toString()) {
console.warn("MTU value changed: config.mtu=", root.config.mtu, "value=", value, "displayText=", displayText)
root.editClicked()
}
}
}
onValueChanged: {
if (hasMTU) {
if (!root.config.hasOwnProperty("mtu") || root.config.mtu !== value) {
root.config.mtu = value
root.editClicked()
}
}
}
property bool mtuChanged: false
onDisplayTextChanged: {
if (hasMTU) {
const cleanDisplayText = displayText.replace(/,/g, "")
mtuChanged = (root.config.mtu !== value || cleanDisplayText !== value.toString())
if (mtuChanged) {
console.warn("MTU value changed: config.mtu=", root.config.mtu, "value=", value, "displayText=", displayText)
}
}
}
onValueChanged: {
if (hasMTU && mtuChanged) {
root.config.mtu = value
root.editClicked()
mtuChanged = false
}
}
validator: IntValidator {
bottom: 68
top: 9000
}这些改进可以:
|
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, robertkill 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 |
Fixed MTU spinbox locale issue that caused incorrect number formatting with thousand separators. Changed from custom text formatter to using C locale which doesn't include number grouping. Added displayTextChanged handler to properly detect when MTU value changes and trigger edit state. This ensures consistent number display and reliable change detection.
Log: Fixed MTU input field formatting and change detection
Influence:
fix: 修复MTU输入格式化和变更检测问题
修复了MTU微调框的区域设置问题,该问题导致数字格式错误显示千位分隔
符。从自定义文本格式化器改为使用不包含数字分组的C区域设置。添加了
displayTextChanged处理程序以正确检测MTU值变化并触发编辑状态。这确保了数
字显示的一致性和变更检测的可靠性。
Log: 修复MTU输入字段格式化和变更检测问题
Influence:
PMS: BUG-338289
Summary by Sourcery
Ensure consistent MTU input formatting without grouping and add reliable change detection via displayTextChanged handler
Bug Fixes: