Sur cette page

FinalState QML Type

Fournit un état final. Plus d'informations...

Import Statement: import QtQml.StateMachine 6.11
Inherits:

QAbstractState

Description détaillée

Un état final est utilisé pour indiquer qu'une (partie d'une) StateMachine a terminé son travail. Lorsqu'un état final de niveau supérieur est entré, le signal finished() de la machine d'état est émis. En général, lorsqu'un sous-état final (un enfant d'un État) est entré, le signal finished() de l'État parent est émis. FinalState fait partie de Qt State Machine QML API

Pour utiliser un état final, il faut créer un objet FinalState et lui ajouter une transition à partir d'un autre état.

Exemple d'utilisation

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

Voir également StateMachine et 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.