Skip to content

Commit

Permalink
fix: update page indicator when page count changed
Browse files Browse the repository at this point in the history
全屏启动器,当页码数量变化时更新页码指示器。

Issue: linuxdeepin/developer-center#6861
  • Loading branch information
BLumia committed Jan 11, 2024
1 parent cede0e7 commit 267f601
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion qml/FullscreenFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,22 @@ Control {

currentIndex: indicator.currentIndex

// To ensure toplevelRepeater's model (page count) updated correctly
// Caution! Don't put it directly under a Repeater{}, that will prevent Connections from working
Connections {
target: MultipageProxyModel
function onRowsInserted() {
toplevelRepeater.pageCount = MultipageProxyModel.pageCount(0)
}
function onRowsRemoved() {
toplevelRepeater.pageCount = MultipageProxyModel.pageCount(0)
}
}

Repeater {
model: MultipageProxyModel.pageCount(0) // FIXME: should be a property?
id: toplevelRepeater
property int pageCount: MultipageProxyModel.pageCount(0)
model: pageCount

Loader {
active: SwipeView.isCurrentItem || SwipeView.isNextItem || SwipeView.isPreviousItem
Expand Down

0 comments on commit 267f601

Please sign in to comment.