From 36a45a48d9765f2ecebab51cf5903cf33d580740 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 15 Apr 2023 04:48:38 +0300 Subject: [PATCH] [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) --- app/qml/BooksBookView.qml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/qml/BooksBookView.qml b/app/qml/BooksBookView.qml index 48a6240..54e2924 100644 --- a/app/qml/BooksBookView.qml +++ b/app/qml/BooksBookView.qml @@ -1,6 +1,6 @@ /* + Copyright (C) 2015-2023 Slava Monich Copyright (C) 2015-2022 Jolla Ltd. - Copyright (C) 2015-2022 Slava Monich You may use this file under the terms of BSD license as follows: @@ -280,8 +280,6 @@ Item { pager.setPage(currentPage) } - onCurrentIndexChanged: updateModel() - onMovingChanged: updateModel() delegate: BooksPageView { @@ -368,9 +366,9 @@ Item { } function updateModel() { - if (completed && !moving && currentIndex >= 0 && !bookViewWatcher.updatingViewPosition) { + if (completed && !moving && bookViewWatcher.currentIndex >= 0 && !bookViewWatcher.updatingViewPosition) { hideViews() - stackModel.currentPage = currentIndex + stackModel.currentPage = bookViewWatcher.currentIndex } } @@ -378,6 +376,7 @@ Item { id: bookViewWatcher listView: bookView + onCurrentIndexChanged: bookView.updateModel() } NumberAnimation {