Sur cette page

FinalState QML Type

Fournit un état final. En savoir plus…

Import Statement: import QtQml.StateMachine 6.12
Inherits:

QAbstractState

Description détaillée

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

Pour utiliser un état final, vous devez créer un objet FinalState et y 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.