From b35a8832db086c16f45222b854cfc77bf16a6da7 Mon Sep 17 00:00:00 2001 From: Chupligin Sergey Date: Sun, 22 Oct 2023 16:48:14 +0000 Subject: [PATCH] [ApplicationWindow] Add pop and replace functions --- src/controls/qml/ApplicationWindow.qml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/controls/qml/ApplicationWindow.qml b/src/controls/qml/ApplicationWindow.qml index 3ed3e9a..326f003 100644 --- a/src/controls/qml/ApplicationWindow.qml +++ b/src/controls/qml/ApplicationWindow.qml @@ -78,6 +78,24 @@ NemoWindow { } } + function pop() { + pageStack.pop() + } + + function replace(url, params) { + if(!params){ + params = {} + } + + var component = Qt.createComponent(url) + if (component.status === Component.Ready) { + pageStack.push(component.createObject(pageStack, params)) + } else { + console.warn("Error loading component", url, component.errorString()) + pageStack.push(Qt.resolvedUrl("ErrorStackPage.qml"), {error: component.errorString()}) + } + } + Timer { id: _errorTimer property string errorString