Unsolved QStateMachine Custom Events and Transitions
-
Hi,
that is my first message here. Hello to everyone. :)I'm learning QtStateMachine Framework... i am not able to create a simple code
that use (Custom events and transiotions) :
machine.postEvent(new StringEvent("Hello"));
The code is posted in this link https://doc.qt.io/qt-5/statemachine-api.html# but it doesn't work... can you try and help me ? thanks :)
-
Hi and welcome to the forum
You are using all of it?
Including the
class StringTransition : public QAbstractTransition
and so on?
Also, the sample just shows
QStateMachine machine;
Make sure its not inside a function or other scope where it won't survive
long enough to get any events. ( like inside a buttons click function) -
@mrjj said in QStateMachine Custom Events and Transitions:
class StringTransition : public QAbstractTransition
Yes i use the class StringTransition : public QAbstractTransition
Can you please provide me a simple example (2 simple state) with Custom events and transitions?
Thanks a lot :) -
@Belfix
Hi
Have a look at this
http://blackberry.github.io/Qt2Cascades-Samples/docs/statemachine-pingpong.html
Its ping / pong so its as 2 state as it gets :) -
@mrjj Thanks a lot! I will study it :)