[app] Fetch current book index from ListWatcher
It appears that ListView's currentIndex on the QML side doesn't always match the one on the native side (and when they differ, the native one tracked by ListWatcher is the right one)
This commit is contained in:
parent
06ff22f886
commit
36a45a48d9
1 changed files with 4 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
Copyright (C) 2015-2023 Slava Monich <slava@monich.com>
|
||||||
Copyright (C) 2015-2022 Jolla Ltd.
|
Copyright (C) 2015-2022 Jolla Ltd.
|
||||||
Copyright (C) 2015-2022 Slava Monich <slava.monich@jolla.com>
|
|
||||||
|
|
||||||
You may use this file under the terms of BSD license as follows:
|
You may use this file under the terms of BSD license as follows:
|
||||||
|
|
||||||
|
@ -280,8 +280,6 @@ Item {
|
||||||
pager.setPage(currentPage)
|
pager.setPage(currentPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentIndexChanged: updateModel()
|
|
||||||
|
|
||||||
onMovingChanged: updateModel()
|
onMovingChanged: updateModel()
|
||||||
|
|
||||||
delegate: BooksPageView {
|
delegate: BooksPageView {
|
||||||
|
@ -368,9 +366,9 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateModel() {
|
function updateModel() {
|
||||||
if (completed && !moving && currentIndex >= 0 && !bookViewWatcher.updatingViewPosition) {
|
if (completed && !moving && bookViewWatcher.currentIndex >= 0 && !bookViewWatcher.updatingViewPosition) {
|
||||||
hideViews()
|
hideViews()
|
||||||
stackModel.currentPage = currentIndex
|
stackModel.currentPage = bookViewWatcher.currentIndex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,6 +376,7 @@ Item {
|
||||||
id: bookViewWatcher
|
id: bookViewWatcher
|
||||||
|
|
||||||
listView: bookView
|
listView: bookView
|
||||||
|
onCurrentIndexChanged: bookView.updateModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
|
Loading…
Reference in a new issue