Nesta página

FinalState QML Type

Fornece um estado final. Mais...

Import Statement: import QtQml.StateMachine 6.12
Inherits:

QAbstractState

Descrição detalhada

Um estado final é usado para indicar que (parte de) uma máquina de estados ( StateMachine ) concluiu seu trabalho. Quando se entra em um estado final de nível superior, o sinal finished() da máquina de estados é emitido. Em geral, quando se entra em um subestado final (um filho de um Estado), o sinal finished() do estado pai é emitido. O `FinalState` faz parte da API QML do `Qt State Machine `

Para usar um estado final, crie um objeto `FinalState` e adicione a ele uma transição a partir de outro estado.

Exemplo de uso

import QtQuick
import QtQml.StateMachine as DSM

Rectangle {
    DSM.StateMachine {
        id: stateMachine
        initialState: state
        running: true
        DSM.State {
            id: state
            DSM.TimeoutTransition {
                targetState: finalState
                timeout: 200
            }
        }
        DSM.FinalState {
            id: finalState
        }
        onFinished: console.log("state finished")
    }
}

Veja também StateMachine e State.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.