En esta página

FinalState QML Type

Proporciona un estado final. Más...

Import Statement: import QtQml.StateMachine 6.11
Inherits:

QAbstractState

Descripción detallada

Un estado final se utiliza para comunicar que (parte de) un StateMachine ha terminado su trabajo. Cuando se entra en un estado final de nivel superior, se emite la señal finished() de la máquina de estados. En general, cuando se entra en un subestado final (hijo de un estado), se emite la señal finished() del estado padre. FinalState forma parte de Qt State Machine QML API

Para utilizar un estado final, se crea un objeto FinalState y se le añade una transición desde otro estado.

Ejemplo 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")
    }
}

Véase también StateMachine y 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.