fix: reset grid view index when hiding launcher#664
Merged
Conversation
1. Add property alias to expose grid view current index from list view page item 2. Reset grid view index to 0 when hiding launcher to ensure consistent state 3. This prevents the grid view from retaining previous selection when launcher is reopened 4. Improves user experience by always starting from first item after hide/show cycle fix: 隐藏启动器时重置网格视图索引 1. 添加属性别名以暴露列表视图页面项的网格视图当前索引 2. 隐藏启动器时将网格视图索引重置为0以确保状态一致 3. 防止启动器重新打开时网格视图保留之前的选中状态 4. 通过始终在隐藏/显示循环后从第一项开始来改善用户体验 PMS: BUG-337493
Reviewer's guide (collapsed on small PRs)Reviewer's GuideExpose the grid view’s current index via a QML property alias and reset it to 0 when hiding the launcher to prevent stale selections and ensure a consistent user experience on reopen Class diagram for ListViewPageItem and gridViewIndex property aliasclassDiagram
class ListViewPageItem {
+int viewIndex
+int gridViewIndex
}
ListViewPageItem : gridViewIndex = gridViewContainer.currentIndex
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review我来对这段代码变更进行审查:
改进建议:
// 暴露当前网格视图的索引,用于外部重置
property alias gridViewIndex: gridViewContainer.currentIndex
// 重置网格视图的选中项到第一项
if (listviewPage.currentItem) {
listviewPage.currentItem.gridViewIndex = 0
}
readonly property int defaultGridIndex: 0
...
listviewPage.currentItem.gridViewIndex = defaultGridIndex
function resetGridViewIndex() {
if (listviewPage.currentItem) {
listviewPage.currentItem.gridViewIndex = defaultGridIndex
}
}总体来说,这个变更实现了功能需求,代码质量良好,但可以通过添加注释和适当的重构来提高可维护性。 |
BLumia
requested changes
Oct 24, 2025
BLumia
left a comment
Member
There was a problem hiding this comment.
需求文档:
● 关闭启动器后再次进入时,停留在前一次退出的页面;启动器由窗口模式切换到全屏时,停留在首页;
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia, wjyrich 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 |
Contributor
Author
|
/forcemerge |
|
This pr force merged! (status: blocked) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: 隐藏启动器时重置网格视图索引
PMS: BUG-337493
Summary by Sourcery
Expose grid view current index via a property alias and reset it to zero when hiding the launcher to prevent stale selection and improve user experience
New Features:
Bug Fixes:
Enhancements: