Auf dieser Seite

FinalState QML Type

Stellt einen Endzustand bereit. Mehr...

Import Statement: import QtQml.StateMachine 6.12
Inherits:

QAbstractState

Ausführliche Beschreibung

Ein Endzustand wird verwendet, um mitzuteilen, dass (ein Teil) eines Zustandsbaums ( StateMachine ) seine Arbeit beendet hat. Wenn ein Endzustand auf oberster Ebene erreicht wird, wird das Signal „ finished()“ der Zustandsmaschine ausgelöst. Im Allgemeinen wird beim Erreichen eines Endunterzustands (einem Kind eines Zustands) das Signal „ finished()“ des übergeordneten Zustands ausgelöst. „FinalState“ ist Teil der QML-API „Qt State Machine “

Um einen Endzustand zu verwenden, erstellen Sie ein „FinalState“-Objekt und fügen ihm einen Übergang von einem anderen Zustand hinzu.

Anwendungsbeispiel

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

Siehe auch StateMachine und 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.