I have a C++ class and I made it possible to be able to create it in QML. Then I have a signal in QML which has an argument representing this object. I am using the QtQml.StateMachine
and I am catching triggered signals with SignalTransition
. I want to be able to set my signals argument to the next state when the SignalTransition
triggers. In code:
This is how my signal looks like in Model.qml:
signal mySignal(CustomObject customObject)
My signal transitioning code in State.qml:
import QtQml.StateMachine 1.0 as SM
// SM.State { ...
Model {
id: model
// ...
}
SM.SignalTransition {
targetState: nextState
signal: model.mySignal
onTriggered: console.log(customObject) // error here
}
// ... }
I get the following error: ReferenceError: customObject is not defined
.
When I am emitting the signal I pass my customObject as an argument for the signal.