an unsuccessful attemnt to calculate current/total pages
This commit is contained in:
1 parent
353c82f6d6
commit
1a4726b95a
6 files changed
+288
-3
No files matched your search
@@ -27,7 +27,18 @@ Rectangle {
|
||||
text: model.content
|
||||
}
|
||||
|
||||
onContentYChanged: scrollTrackTimer.restart()
|
||||
onContentYChanged: {
|
||||
scrollTrackTimer.restart()
|
||||
var idx = chunkListView.indexAt(0, chunkListView.contentY)
|
||||
if (idx >= 0) {
|
||||
var item = chunkListView.itemAtIndex(idx)
|
||||
var offset = item ? chunkListView.contentY - item.y : 0
|
||||
readingModel.setScrollInfo(idx, offset)
|
||||
}
|
||||
}
|
||||
|
||||
onWidthChanged: readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
||||
onHeightChanged: readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
policy: ScrollBar.AsNeeded
|
||||
@@ -78,6 +89,18 @@ Rectangle {
|
||||
chunkListView.contentY += appState.lastScrollOffset
|
||||
})
|
||||
}
|
||||
Qt.callLater(function() {
|
||||
readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: readingModel
|
||||
function onChapterChanged() {
|
||||
Qt.callLater(function() {
|
||||
readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user