diff --git a/qml/FullscreenFrame.qml b/qml/FullscreenFrame.qml index 6c93c4e1..94e82c73 100644 --- a/qml/FullscreenFrame.qml +++ b/qml/FullscreenFrame.qml @@ -380,7 +380,10 @@ InputEventItem { } else { gridViewContainer.setPreviousPageSwitch(false) } - listviewPage.previousIndex = listviewPage.currentIndex + // 延迟更新previousIndex,避免重复处理 + Qt.callLater(function() { + listviewPage.previousIndex = listviewPage.currentIndex + }) } Keys.onLeftPressed: function(event) { @@ -394,7 +397,7 @@ InputEventItem { } Keys.onRightPressed: function(event) { if (listItem.viewIndex === (itemPageModel.rowCount() - 1) && itemPageModel.rowCount() > 1) { - // is the last page, go to last page + // is the last page, go to first page listviewPage.setCurrentIndex(0) } else { // not the last page, simply use SwipeView default behavior diff --git a/qml/GridViewContainer.qml b/qml/GridViewContainer.qml index 0ebaada2..46ada98d 100644 --- a/qml/GridViewContainer.qml +++ b/qml/GridViewContainer.qml @@ -122,7 +122,7 @@ FocusScope { Rectangle { anchors { fill: parent - margins: 5 + margins: 5 } radius: 18 color: Qt.rgba(0, 0, 0, 0.2) @@ -135,16 +135,6 @@ FocusScope { // not wroking move: root.itemMove moveDisplaced: root.itemMove - - Keys.onPressed: function (event) { - if (event.key === Qt.Key_Right && currentIndex === gridView.count - 1) { - gridView.currentIndex = 0; - event.accepted = true; - } else if (event.key === Qt.Key_Left && currentIndex === 0) { - currentIndex = gridView.count - 1; - event.accepted = true; - } - } } }