fix animations
This commit is contained in:
2 files changed
+17
-7
No files matched your search
@@ -278,3 +278,4 @@ All colors are defined in `src/qml/Theme.qml` (a QML singleton registered via `q
|
||||
- `QSettings` for persistent state
|
||||
- Qt naming: `camelCase` properties/methods, `PascalCase` QML component names
|
||||
- `Q_INVOKABLE` for QML-callable methods; signals for C++→QML notifications
|
||||
- **Never use timers or `Qt.callLater` to wait for state to settle** — always use signals (`onRunningChanged`, `onCompleted`, etc.) or direct synchronous calls. Timeouts are fragile and mask real sequencing problems.
|
||||
@@ -34,16 +34,18 @@ Rectangle {
|
||||
|
||||
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, chunkListView.atYEnd)
|
||||
if (!viewportSizeTimer.running) {
|
||||
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, chunkListView.atYEnd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onWidthChanged: readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
||||
onHeightChanged: readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
||||
onWidthChanged: viewportSizeTimer.restart()
|
||||
onHeightChanged: viewportSizeTimer.restart()
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
policy: ScrollBar.AsNeeded
|
||||
@@ -69,6 +71,13 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: viewportSizeTimer
|
||||
interval: 50
|
||||
repeat: false
|
||||
onTriggered: readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: scrollTrackTimer
|
||||
interval: 300
|
||||
|
||||
Reference in new issue
Block a user