From 720222e09c4684f6d4cb9495afbada6fe42ca868 Mon Sep 17 00:00:00 2001 From: uncor3 Date: Mon, 8 Jun 2026 21:05:09 +0000 Subject: [PATCH] feat(StateView): add auto-switch functionality for loading state --- src/ui/base/StateView.qml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ui/base/StateView.qml b/src/ui/base/StateView.qml index 18407bb..3988eab 100644 --- a/src/ui/base/StateView.qml +++ b/src/ui/base/StateView.qml @@ -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