Skip to content

Commit 67784c6

Browse files
wjyrichdeepin-bot[bot]
authored andcommitted
feat: Added left and right button switching in full-screen mode.
Also fix bug, when first open launchpad, open show focus in first app. PMS-BUG-289119
1 parent b2f5046 commit 67784c6

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

qml/FullscreenFrame.qml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@ InputEventItem {
380380
} else {
381381
gridViewContainer.setPreviousPageSwitch(false)
382382
}
383-
listviewPage.previousIndex = listviewPage.currentIndex
383+
// 延迟更新previousIndex,避免重复处理
384+
Qt.callLater(function() {
385+
listviewPage.previousIndex = listviewPage.currentIndex
386+
})
384387
}
385388

386389
Keys.onLeftPressed: function(event) {
@@ -394,7 +397,7 @@ InputEventItem {
394397
}
395398
Keys.onRightPressed: function(event) {
396399
if (listItem.viewIndex === (itemPageModel.rowCount() - 1) && itemPageModel.rowCount() > 1) {
397-
// is the last page, go to last page
400+
// is the last page, go to first page
398401
listviewPage.setCurrentIndex(0)
399402
} else {
400403
// not the last page, simply use SwipeView default behavior

qml/GridViewContainer.qml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ FocusScope {
122122
Rectangle {
123123
anchors {
124124
fill: parent
125-
margins: 5
125+
margins: 5
126126
}
127127
radius: 18
128128
color: Qt.rgba(0, 0, 0, 0.2)
@@ -135,16 +135,6 @@ FocusScope {
135135
// not wroking
136136
move: root.itemMove
137137
moveDisplaced: root.itemMove
138-
139-
Keys.onPressed: function (event) {
140-
if (event.key === Qt.Key_Right && currentIndex === gridView.count - 1) {
141-
gridView.currentIndex = 0;
142-
event.accepted = true;
143-
} else if (event.key === Qt.Key_Left && currentIndex === 0) {
144-
currentIndex = gridView.count - 1;
145-
event.accepted = true;
146-
}
147-
}
148138
}
149139
}
150140

0 commit comments

Comments
 (0)