import QtQuick import QtQuick.Controls Rectangle { id: root color: "#000000" width: 800 height: 480 state: "init" property int num: 0 states: [ State { name: "welcome" PropertyChanges { target: root; num: 1 } }, State { name: "ignon" PropertyChanges { target: root; num: 2 } }, State { name: "ignoff" PropertyChanges { target: root; num: 3 } } ] onStateChanged: console.log("onStateChanged", state) transitions: [ Transition { to: "welcome" ScriptAction {script: console.log("transition to welcome")} }, Transition { to: "ignon" ScriptAction {script: console.log("transition to ignon")} }, Transition { to: "ignoff" ScriptAction {script: console.log("transition to ignoff")} } ] Row { Button { text:"welcome" onClicked: root.state = "welcome" } Button { text: "ignon" onClicked: root.state = "ignon" } Button { text: "ignoff" onClicked: root.state = "ignoff" } } }