Conversation
原因:窗口打开的时候会有窗管特效动画,在这个过程中窗口的大小发生变化可能会发生异常抖动和闪烁的情况。 方案: 1.如果需要改变窗口大小,即时处理,不要在showEvent里面去操作。 2.不要依赖isVisible()的状态,而是使用isVisibleTo()。 Log: PMS: BIG-336029
deepin pr auto review代码审查报告经过对提供的 Git diff 进行仔细审查,以下是我的分析意见: 整体评估本次修改主要涉及两个部分:
详细分析1. dockcontentwidget.h 修改- setFixedSize(m_netView->width(), qMax(m_minHeight, m_netView->height() + 20 + m_mainLayout->contentsMargins().top() + (m_netCheckBtn->isVisibleTo(this) ? (m_netSetBtn->height() + m_netCheckBtn->height() + 10) : m_netSetBtn->height())));
+ resize(m_netView->width(), qMax(m_minHeight, m_netView->height() + 20 + m_mainLayout->contentsMargins().top() + (m_netCheckBtn->isVisibleTo(this) ? (m_netSetBtn->height() + m_netCheckBtn->height() + 10) : m_netSetBtn->height())));问题与建议:
2. netview.h 和 netview.cpp 修改问题与建议:
潜在问题:
安全性考虑
总结建议
总体而言,这些修改简化了代码逻辑,但可能引入性能问题,建议在实际使用中进行充分测试。 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefactors when and how the network panel tree view updates expansion state and widget sizing to avoid flicker during window show animations, by removing deferred expand toggling in showEvent, triggering it on row insertion instead, and resizing the container widget directly rather than changing its fixed size. Sequence diagram for updated network panel expansion and sizing behaviorsequenceDiagram
actor User
participant Dock
participant DockContentWidget
participant NetView
participant NetManager
User->>Dock: Click network icon
Dock->>DockContentWidget: Show network popup
DockContentWidget->>NetView: Show
activate NetView
NetView->>NetManager: setAutoScanEnabled(true)
deactivate NetView
NetManager-->>NetView: Insert rows into model
activate NetView
NetView->>NetView: rowsInserted(parent, start, end)
alt WirelessOtherItem or WirelessMineItem inserted
NetView->>NetManager: exec(ToggleExpand, "")
NetView->>NetView: updateItemExpand(item)
else Other item types
NetView->>NetView: updateItemExpand(item)
end
deactivate NetView
loop User resizes content indirectly
DockContentWidget->>NetView: setMaxHeight(h)
DockContentWidget->>NetView: setFixedHeight(h) if needed
DockContentWidget->>DockContentWidget: resize(width, computedHeight)
end
User->>Dock: Close network popup
Dock->>DockContentWidget: Hide network popup
DockContentWidget->>NetView: hide
activate NetView
NetView->>NetManager: exec(ToggleExpand, "")
NetView->>NetManager: setAutoScanEnabled(false)
NetView->>NetView: clear() after delay
deactivate NetView
Class diagram for updated NetView and DockContentWidget sizing and expand logicclassDiagram
class NetManager {
<<QObject>>
+exec(action, argument)
+setAutoScanEnabled(enabled)
}
class NetView {
<<QTreeView>>
-NetManager* m_manager
-NetModel* m_model
-NetDelegate* m_delegate
-bool m_closeOnClear
-int m_maxHeight
+clear()
+rowsInserted(parent, start, end)
+showEvent(event)
+hideEvent(event)
+updateItemExpand(item)
+onExpandStatusChanged()
}
class DockContentWidget {
<<QWidget>>
-NetView* m_netView
-QPushButton* m_netCheckBtn
-QPushButton* m_netSetBtn
-QLayout* m_mainLayout
-int m_minHeight
+setNetCheckBtnVisible(visible)
+updateSize(h)
}
NetView --> NetManager : uses
DockContentWidget --> NetView : contains
class UpdateSizeBehaviorBefore {
+updateSize(h)
+setFixedSize(width, height)
}
class UpdateSizeBehaviorAfter {
+updateSize(h)
+resize(width, height)
}
DockContentWidget ..> UpdateSizeBehaviorBefore : replaced
DockContentWidget ..> UpdateSizeBehaviorAfter : now uses
class ExpandBehaviorBefore {
+showEvent(event)
+execToggleExpandOnFirstShow()
-bool m_shouldUpdateExpand
}
class ExpandBehaviorAfter {
+rowsInserted(parent, start, end)
+execToggleExpandOnRowInsert()
}
NetView ..> ExpandBehaviorBefore : behavior removed
NetView ..> ExpandBehaviorAfter : behavior added
NetView --|> QTreeView
DockContentWidget --|> QWidget
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
rowsInserted,m_manager->exec(NetManager::ToggleExpand, "")is now invoked on every insertion ofWirelessOtherItem/WirelessMineItem; if multiple rows are inserted in a batch this may cause redundant expand toggles, so consider coalescing the calls (e.g., only once perrowsInsertedinvocation or deferring via a single-shot timer).
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `rowsInserted`, `m_manager->exec(NetManager::ToggleExpand, "")` is now invoked on every insertion of `WirelessOtherItem`/`WirelessMineItem`; if multiple rows are inserted in a batch this may cause redundant expand toggles, so consider coalescing the calls (e.g., only once per `rowsInserted` invocation or deferring via a single-shot timer).Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: caixr23, ut003640 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: unstable) |
原因:窗口打开的时候会有窗管特效动画,在这个过程中窗口的大小发生变化可能会发生异常抖动和闪烁的情况。 方案:
1.如果需要改变窗口大小,即时处理,不要在showEvent里面去操作。
2.不要依赖isVisible()的状态,而是使用isVisibleTo()。
Log:
PMS: BIG-336029
Summary by Sourcery
Adjust network panel expansion and sizing behavior to avoid flicker when the popup opens
Bug Fixes:
Enhancements: