Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

state error



  • property var baodu: 100

    states: [
    State {
    name: "awake"
    PropertyChanges { target: root }
    },
    State {
    name: "idle"
    PropertyChanges { target: root; }
    }
    ]
    transitions: [
    Transition {
    enabled: alive
    from: ""; to: "awake"
    ParallelAnimation {
    SequentialAnimation {
    NumberAnimation { target: root; property: "scale"; to: 2; duration: 100 }
    NumberAnimation { target: root; property: "scale"; to: 1; duration: 500 }
    }
    ScriptAction {
    script: {
    ani0.start()
    baodu -= 1
    }
    }
    }
    },
    Transition {
    enabled: alive
    from: "
    "; to: "idle"
    ParallelAnimation {
    ScriptAction {
    script: {
    baodu -= 1
    ani0.start()
    console.log("idle start")
    }
    }
    }
    }
    ]

    Component.onCompleted: {
    state = "awake"
    }

    onBaoduChanged: {
        state = "idle"
    }
    

    result: <Unknown File>: QML StateGroup: Can't apply a state change as part of a state definition.

    I only change the property baodu -= 1


Log in to reply