feat(StateView): add auto-switch functionality for loading state

This commit is contained in:
uncor3
2026-06-08 21:05:09 +00:00
parent 6b4fc34b52
commit 720222e09c
+15 -1
View File
@@ -14,10 +14,24 @@ Item {
property int viewState: StateView.State.Loading
property string errorText: "Something went wrong."
property bool retryable: true
property bool autoSwitchContent: true
property int autoSwitchDelay: 500
property alias contentItem: contentSlot.data
signal retryRequested()
Timer {
id: autoSwitchTimer
interval: root.autoSwitchDelay
repeat: false
running: root.autoSwitchContent && root.viewState === StateView.State.Loading
onTriggered: root.viewState = StateView.State.Content
}
StackLayout {
anchors.fill: parent
currentIndex: root.viewState