Details
-
Technical task
-
Resolution: Unresolved
-
P2: Important
-
None
Description
Parameter injection has been deprecated for signal handlers (https://doc.qt.io/qt-6/qtqml-syntax-signals.html#signal-parameters ). The same needs to be done for SignalTransition.guard, somehow
Code (adapted from https://doc.qt.io/qt-6/qml-qtqml-statemachine-signaltransition.html#guard-prop )
import QtQuick import QtQuick.Controls.Basic import QtQml.StateMachine as DSM Window { width: 640 height: 480 visible: true Button { id: button text: "Quit" // 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") } DSM.StateMachine { id: stateMachine initialState: state running: true DSM.State { id: state DSM.SignalTransition { targetState: finalState signal: button.mysignal guard: mystr === "test" } } DSM.FinalState { id: finalState } onFinished: Qt.quit() } }
Compiler output
Warning: main.qml:27:24: Could not compile binding for guard: Cannot access value for name mystr [compiler] guard: mystr === "test" ^^^^^
Attachments
Issue Links
- relates to
-
QTBUG-77417 qmllint: need to handle SignalTransition guard properties
- Reported