Skip to content
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

fix: failed to switch pages by clicking indicator button #417

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions qml/FullscreenFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ InputEventItem {
if (isLastPage && !dropArea.createdEmptyPage) {
let newPageIndex = ItemArrangementProxyModel.creatEmptyPage()
dropArea.createdEmptyPage = true
listviewPage.currentIndex = newPageIndex
setCurrentIndex(newPageIndex)
parent.pageIntent = 0
return
} else {
Expand Down Expand Up @@ -294,6 +294,10 @@ InputEventItem {
visible: searchEdit.text === ""

currentIndex: indicator.currentIndex
function setCurrentIndex(index) {
listviewPage.currentIndex = index
listviewPage.currentIndex = Qt.binding(function() { return indicator.currentIndex })
}

property int previousIndex: -1
model: itemPageModel
Expand Down Expand Up @@ -362,7 +366,7 @@ InputEventItem {
Keys.onLeftPressed: function(event) {
if (listItem.viewIndex === 0 && itemPageModel.rowCount() > 1) {
// is the 1st page, go to last page
listviewPage.currentIndex = itemPageModel.rowCount() - 1
setCurrentIndex(itemPageModel.rowCount() - 1)
} else {
// not the 1st page, simply use SwipeView default behavior
event.accepted = false
Expand All @@ -371,7 +375,7 @@ InputEventItem {
Keys.onRightPressed: function(event) {
if (listItem.viewIndex === (itemPageModel.rowCount() - 1) && itemPageModel.rowCount() > 1) {
// is the last page, go to last page
listviewPage.currentIndex = 0
setCurrentIndex(0)
} else {
// not the last page, simply use SwipeView default behavior
event.accepted = false
Expand Down Expand Up @@ -498,7 +502,7 @@ InputEventItem {
}

Component.onCompleted: {
listviewPage.currentIndex = 0
setCurrentIndex(0)
}
}

Expand Down Expand Up @@ -681,7 +685,7 @@ InputEventItem {
// reset(remove) keyboard focus
baseLayer.focus = true
// reset page to the first page
listviewPage.currentIndex = 0
setCurrentIndex(0)
}
}
}
Expand Down
Loading