Skip to content

Commit b3b8ba0

Browse files
wjyrichdeepin-bot[bot]
authored andcommitted
feat: improve app list focus behavior and styling
1. Move Keys.onReturnPressed and Keys.onSpacePressed outside of the button delegate to fix scope issues 2. Replace complex BoxPanel background with FocusBoxBorder for menu items, simplifying styling and improving focus visibility 3. Add forceActiveFocus() call when list gains active focus to ensure proper focus management 4. Change category type change behavior from positionViewAtBeginning to setting currentIndex to 0 for better navigation 5. Simplify ItemBackground focus condition by removing focusPolicy check feat: 改进应用列表焦点行为和样式 1. 将 Keys.onReturnPressed 和 Keys.onSpacePressed 移出按钮委托以修复作用 域问题 2. 使用 FocusBoxBorder 替换复杂的 BoxPanel 背景,简化样式并改进焦点可 见性 3. 在列表获得活动焦点时添加 forceActiveFocus() 调用以确保正确的焦点管理 4. 将类别类型更改行为从 positionViewAtBeginning 改为设置 currentIndex 为 0,改善导航体验 5. 通过移除 focusPolicy 检查简化 ItemBackground 焦点条件 PMS: BUG-334167
1 parent 4c52e66 commit b3b8ba0

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

qml/windowed/AppListView.qml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,14 +241,13 @@ FocusScope {
241241
implicitHeight: Helper.windowed.listItemHeight
242242
button: itemDelegate
243243
}
244+
}
245+
Keys.onReturnPressed: {
246+
launchApp(desktopId)
247+
}
244248

245-
Keys.onReturnPressed: {
246-
launchApp(desktopId)
247-
}
248-
249-
Keys.onSpacePressed: {
250-
launchApp(desktopId)
251-
}
249+
Keys.onSpacePressed: {
250+
launchApp(desktopId)
252251
}
253252
}
254253
}
@@ -281,7 +280,7 @@ FocusScope {
281280
anchors.rightMargin: 2
282281
anchors.top: parent.top
283282
anchors.bottom: parent.bottom
284-
visible: menuItem.down || menuItem.hovered
283+
visible: menuItem.highlighted
285284
outsideBorderColor: null
286285
insideBorderColor: null
287286
radius: 6
@@ -332,13 +331,15 @@ FocusScope {
332331
if (activeFocus) {
333332
// When focus in, we always scroll to the highlight
334333
scrollToIndex(listView.currentIndex, 0)
334+
if(currentItem)
335+
currentItem.forceActiveFocus()
335336
}
336337
}
337338

338339
Connections {
339340
target: CategorizedSortProxyModel
340341
function onCategoryTypeChanged() {
341-
listView.positionViewAtBeginning()
342+
listView.currentIndex = 0
342343
}
343344
}
344345

qml/windowed/ItemBackground.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ D.BoxPanel {
3939

4040
Loader {
4141
anchors.fill: parent
42-
active: button.visualFocus && control.focusPolicy !== Qt.NoFocus
42+
active: button.visualFocus
4343

4444
sourceComponent: D.FocusBoxBorder {
4545
radius: control.radius

0 commit comments

Comments
 (0)