Application name, IDs

# Automatic State Saving

During application development it is often required to start an application from a view which depends on the previous application runs. Like a web browser should remember the number of opened tabs, their content or the browsing history, or a news reader application should continue from the last news the application was opened on, preferably from the same position.

Lomiri UI toolkit provides a simple way to save the state of any component within an application, by using the attached component StateSaver. By simply attaching this component to any QtQuick component and specifying the properties to be saved, applications can be restored to any previous state they were before being closed.

Consider the following simple QtQuick application, which on button press randomly changes its background.

    import QtQuick 2.4
    import Lomiri.Components 1.2

    Rectangle {
        id: root
        width: units.gu(40)
        height: units.gu(71)
        color: "green"
        StateSaver.properties: "color"

        Button {
            text: "Change color"
            anchors.centerIn: parent
            onClicked: {
                root.color = Qt.rgba(Math.random(1), Math.random(1), Math.random(1), 1);
            }
        }
    }

But let's see what else is neded to properly save an application's components proeprties.