-
Notifications
You must be signed in to change notification settings - Fork 37
fix: freefrom sort listview position is not positioned at beginning #694
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
修正自由排序的列表视图在启动时和从其他模式切换到自由排序模式时,视图 位置不在最顶端的问题.有下面的原因: 1. ListView.contentY 实际是 Flickable.contentY, ListView 的 contentY 不一定是 0 为起点. 2. 目前,小窗口启动器的视图位置重置只会在隐藏时进行, 会导致首次启动后 启动器的自由排序模式视图位置不对(因为没变为隐藏过,所以没被重置). PMS: BUG-348311 Log:
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnsures the free-sort app list view is reset to the top both on initial creation and when resetting its state by using ListView’s positioning API correctly and triggering a view state reset when the windowed launcher frame is completed. Sequence diagram for windowed launcher startup and list view resetsequenceDiagram
participant WindowedFrame
participant LauncherController
participant appList as FreeSortListView
rect rgb(230,230,255)
WindowedFrame->>WindowedFrame: Component.onCompleted
WindowedFrame->>appList: resetViewState()
activate appList
appList->>appList: set currentIndex = 0
appList->>appList: set highlightFollowsCurrentItem = false
appList->>appList: positionViewAtBeginning()
appList->>appList: restore highlightFollowsCurrentItem
deactivate appList
end
rect rgb(230,255,230)
LauncherController->>LauncherController: onVisibleChanged(visible = false)
LauncherController->>appList: resetViewState()
activate appList
appList->>appList: set currentIndex = 0
appList->>appList: set highlightFollowsCurrentItem = false
appList->>appList: positionViewAtBeginning()
appList->>appList: restore highlightFollowsCurrentItem
deactivate appList
end
Class diagram for updated windowed launcher view reset behaviorclassDiagram
class WindowedFrame {
+Component_onCompleted()
+Connections_onVisibleChanged()
}
class LauncherController {
+visible : bool
+onVisibleChanged(visible)
}
class FreeSortListView {
+listView_currentIndex : int
+listView_highlightFollowsCurrentItem : bool
+resetViewState()
+listView_positionViewAtBeginning()
}
WindowedFrame --> LauncherController : observes visible
WindowedFrame --> FreeSortListView : appList
LauncherController --> FreeSortListView : calls resetViewState()
FreeSortListView : resetViewState() sets listView_currentIndex = 0
FreeSortListView : resetViewState() disables listView_highlightFollowsCurrentItem
FreeSortListView : resetViewState() calls listView_positionViewAtBeginning()
FreeSortListView : resetViewState() restores listView_highlightFollowsCurrentItem
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review这段代码变更主要涉及 QML (Qt Modeling Language) 中列表视图的状态重置逻辑。以下是对这段 diff 的详细审查和改进意见: 1. 语法逻辑审查变更点 1:
变更点 2:
2. 代码质量
3. 代码性能
4. 代码安全
总结与改进建议这段 diff 整体上是高质量的修复,主要提升了代码的健壮性和逻辑正确性。 建议:
|
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.
Hey - I've left some high level feedback:
- Consider guarding
appList.resetViewState()inComponent.onCompletedwith a null/ready check (orappList && appList.resetViewState) to avoid issues ifappListis not yet initialized when the frame completes. - If
resetViewState()affects modes other than free-sort, it might be worth tightening the condition under which it's called on startup so that only the relevant view/mode is reset.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider guarding `appList.resetViewState()` in `Component.onCompleted` with a null/ready check (or `appList && appList.resetViewState`) to avoid issues if `appList` is not yet initialized when the frame completes.
- If `resetViewState()` affects modes other than free-sort, it might be worth tightening the condition under which it's called on startup so that only the relevant view/mode is reset.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: BLumia, 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 |
修正自由排序的列表视图在启动时和从其他模式切换到自由排序模式时,视图
位置不在最顶端的问题.有下面的原因:
关联:
Summary by Sourcery
Ensure the free-sort app list view is reset to the top on initial launch and when entering free-sort mode so that the list starts at the beginning.
Bug Fixes: