SignalTransition QML Type
SignalTransition 유형은 Qt 신호에 기반한 전환을 제공합니다. 더 보기...
Import Statement: | import QtQml.StateMachine 6.8 |
Inherits: |
속성
상세 설명
SignalTransition은 Qt State Machine QML API의 일부입니다.
사용 예시
import QtQuick import QtQml.StateMachine as DSM Rectangle { DSM.StateMachine { id: stateMachine initialState: state running: true DSM.State { id: state DSM.SignalTransition { targetState: finalState signal: button.clicked guard: guardButton.checked } } DSM.FinalState { id: finalState } onFinished: Qt.quit() } Row { spacing: 2 Button { id: button text: "Finish state" } Button { id: guardButton checkable: true text: checked ? "Press to block the SignalTransition" : "Press to unblock the SignalTransition" } } }
StateMachine, FinalState, TimeoutTransition 를참조하세요 .
속성 문서
guard : bool |
가드 조건은 상태 머신이 참으로 평가될 때만 전환을 활성화하고 거짓으로 평가될 때 비활성화함으로써 상태 머신의 동작에 영향을 미칩니다.
이 신호 전환과 관련된 신호가 방출되면 가드 조건이 평가됩니다. 가드 조건에서 신호의 인수는 아래 예시와 같이 사용할 수 있습니다.
import QtQuick import QtQml.StateMachine as DSM Rectangle { Button { anchors.fill: parent id: button DSM.StateMachine { DSM.State { DSM.SignalTransition { targetState: finalState signal: button.mysignal // the guard condition uses the mystr string argument from mysignal guard: mystr == "test" } } DSM.FinalState { id: finalState } } // define the signal the SignalTransition is connected with signal mysignal(mystr: string) // on clicking the button emit the signal with a single string argument onClicked: button.mysignal("test") } }
signal 를참조하세요 .
signal : signal |
이 신호 전환과 연관된 신호입니다.
import QtQuick import QtQml.StateMachine as DSM Rectangle { Button { anchors.fill: parent id: button DSM.StateMachine { DSM.State { DSM.SignalTransition { targetState: finalState signal: button.clicked } } DSM.FinalState { id: finalState } } } }
© 2025 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.