Important: Please read the Qt Code of Conduct -

How to receive and react to statemachine targetless transitions ?

  • Hi,

    in the Qt documentation of the State machine it says :

    A transition need not have a target state. A transition without a target can be triggered the same way as any other transition; the difference is that it doesn't cause any state changes. This allows you to react to a signal or event when your machine is in a certain state, without having to leave that state.

    So, I have created such a target less transition in my state chart :

    0_1527712322259_Screen Shot 2018-05-30 at 22.31.41.png

    The scenario I need to cover is this :

    While in the imageReview state, I want to send the event nextImg on a button press. So, somehow I need to receive this signal, select the next image and set the image.source to the newly selected image. I don't want to leave the imageReview state.

    Somehow, I can't figure out how I can listen for this particular signal.

    Can someone give me some hint how to handle that purely in QML ?



  • Qt Champions 2017

    If you want to connect for particular signal, first define the function in QML and use Connections object or <id>.signalName.connect(..) to connect with particular handler.