fix animations
This commit is contained in:
2 files changed
+12
-2
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
|
- `QSettings` for persistent state
|
||||||
- Qt naming: `camelCase` properties/methods, `PascalCase` QML component names
|
- Qt naming: `camelCase` properties/methods, `PascalCase` QML component names
|
||||||
- `Q_INVOKABLE` for QML-callable methods; signals for C++→QML notifications
|
- `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,6 +34,7 @@ Rectangle {
|
|||||||
|
|
||||||
onContentYChanged: {
|
onContentYChanged: {
|
||||||
scrollTrackTimer.restart()
|
scrollTrackTimer.restart()
|
||||||
|
if (!viewportSizeTimer.running) {
|
||||||
var idx = chunkListView.indexAt(0, chunkListView.contentY)
|
var idx = chunkListView.indexAt(0, chunkListView.contentY)
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
var item = chunkListView.itemAtIndex(idx)
|
var item = chunkListView.itemAtIndex(idx)
|
||||||
@@ -41,9 +42,10 @@ Rectangle {
|
|||||||
readingModel.setScrollInfo(idx, offset, chunkListView.atYEnd)
|
readingModel.setScrollInfo(idx, offset, chunkListView.atYEnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onWidthChanged: readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
onWidthChanged: viewportSizeTimer.restart()
|
||||||
onHeightChanged: readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
onHeightChanged: viewportSizeTimer.restart()
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar {
|
ScrollBar.vertical: ScrollBar {
|
||||||
policy: ScrollBar.AsNeeded
|
policy: ScrollBar.AsNeeded
|
||||||
@@ -69,6 +71,13 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: viewportSizeTimer
|
||||||
|
interval: 50
|
||||||
|
repeat: false
|
||||||
|
onTriggered: readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
||||||
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: scrollTrackTimer
|
id: scrollTrackTimer
|
||||||
interval: 300
|
interval: 300
|
||||||
|
|||||||
Reference in new issue
Block a user