fix: fix bubble list layout update on height change#1664
Conversation
|
Hi @52cyb. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Reviewer's GuideSwitches bubble replacement logic from remove/insert to QList::replace + dataChanged, and adds an explicit height change handler in the QML delegate to force proper ListView relayout when bubble heights change during transitions. Sequence diagram for bubble replacement and height relayoutsequenceDiagram
participant BubbleModel
participant m_bubbles as QList_BubbleItem
participant View as ListView_view
participant Delegate as BubbleDelegate
BubbleModel->>BubbleModel: replaceBubble(bubble)
BubbleModel->>m_bubbles: replace(replaceIndex, bubble)
BubbleModel-->>View: dataChanged(index(replaceIndex), index(replaceIndex))
View-->>Delegate: update delegate for replaceIndex
alt [bubbleContent.height changes]
Delegate-->>Delegate: onHeightChanged
Delegate-->>View: read displayMarginBeginning
Delegate->>View: set displayMarginBeginning(m + 1)
Delegate->>View: set displayMarginBeginning(m)
View-->>View: forceLayoutPolish() with updated contentHeight
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
|
||
| height: bubbleContent.height | ||
|
|
||
| onHeightChanged: { |
There was a problem hiding this comment.
这个能再优化下么,减少view变化的触发,另外这个逻辑放在main.qml里,listview里,
Replace the remove/insert workaround with `replace` + `dataChanged` and handle height recalculations properly by toggling displayMarginBeginning. The old approach of removing and inserting items forced delegate recreation but caused unnecessary overhead and potential visual glitches. The new approach uses QList::replace() which is more efficient, but requires explicit handling of height updates because the view's transition logic can prevent proper re-layout when an item's height changes during a running transition. Influence: 1. Test notification bubble replacement in normal scenarios 2. Test bubble height changes when content updates (e.g., expanding/ collapsing) 3. Verify no visual glitches during rapid notification updates 4. Test with multiple simultaneous notifications and transitions 5. Verify smooth scrolling behavior when bubble heights change 6. Test edge cases with very long notification messages fix: 修复气泡列表高度变化时布局更新问题 用 `replace` + `dataChanged` 替换移除/插入的变通方案,并通过切换 displayMarginBeginning 正确处理高度重新计算。旧方法通过移除和插入项目 强制 委托重建,但导致不必要的开销和潜在的视觉问题。新方法使用 QList::replace() 效率更高,但需要显式处理高度更新,因为视图的过渡逻辑可能会在运行过渡期间 阻止项目高度变化时的正确重新布局。 Influence: 1. 测试正常场景下的通知气泡替换 2. 测试内容更新时气泡高度的变化(如展开/折叠) 3. 验证快速更新通知时无视觉闪烁 4. 测试多个同时发生的通知和过渡 5. 验证气泡高度变化时滚动行为流畅 6. 测试超长通知消息的边界情况 PMS: BUG-367205
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, 52cyb 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 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Replace the remove/insert workaround with
replace+dataChangedand handleheight recalculations properly by toggling displayMarginBeginning. The old
approach of removing and inserting items forced delegate recreation but caused
unnecessary overhead and potential visual glitches. The new approach uses
QList::replace() which is more efficient, but requires explicit handling of
height updates because the view's transition logic can prevent proper re-layout when an item's height changes during a running transition.
Influence:
fix: 修复气泡列表高度变化时布局更新问题
用
replace+dataChanged替换移除/插入的变通方案,并通过切换displayMarginBeginning 正确处理高度重新计算。旧方法通过移除和插入项目
强制
委托重建,但导致不必要的开销和潜在的视觉问题。新方法使用
QList::replace()
效率更高,但需要显式处理高度更新,因为视图的过渡逻辑可能会在运行过渡期间
阻止项目高度变化时的正确重新布局。
Influence:
PMS: BUG-367205
Summary by Sourcery
Improve notification bubble replacement to use in-place model updates and ensure list layout recalculates correctly when bubble heights change.
Bug Fixes:
Enhancements: