Questions tagged [qstatemachine]

QStateMachine is based on the concepts and notation of Statecharts. QStateMachine is part of The State Machine Framework.

A state machine manages a set of states (classes that inherit from QAbstractState) and transitions (descendants of QAbstractTransition) between those states; these states and transitions define a state graph. Once a state graph has been built, the state machine can execute it. QStateMachine's execution algorithm is based on the State Chart XML (SCXML) algorithm. The framework's overview gives several state graphs and the code to build them.

52 questions
1
vote
1 answer

How to change state from the state object itself not outside?

class ListenState : public QState { public: ListenState(); ~ListenState(); signals: void nextState(); public slots: void getSettings(); }; The cpp file is ListenState::ListenState() { …
zar
  • 11,361
  • 14
  • 96
  • 178
1
vote
0 answers

QStateMachine with RestoreProperty is losing property on transition

The Qt documentation for State machines shows two principles I'm using: Restoring Properties and Targetless transitions. The first allows to assign properties to a QState, the second to trigger events only in a specific state. When I combine both…
MatthiasB
  • 1,759
  • 8
  • 18
1
vote
0 answers

Add my own animation between two QStates

I have a class that simply animates a QGraphicsItem successfully. class LineAnimator : public QAbstractAnimation { public: LineAnimator(QPointF start, QPointF end, QGraphicsItem* shape, QObject* parent=0) : QAbstractAnimation(parent),…
Ehsan Toghian
  • 548
  • 1
  • 6
  • 26
1
vote
1 answer

Qt QStateMachine Sync Problems: Initial State not set on Started Signal

So I am trying to understand a problem with Qt's QStateMachine and I'm hoping someone can help explain why this is happening. I'm very interested in the fundamental understanding of QStateMachine rather than just the fix. First consider the state…
David Mokon Bond
  • 1,576
  • 2
  • 18
  • 42
0
votes
1 answer

Transitioning between menu screens with QStateMachine

I am considering transitioning between menu screens in a game by using QStateMachine. However, I'm unsure how to kick off some code (e.g. show() a QWidget) upon a transition between states occurring. I can do it quite easily with plain old signals…
Mitch
  • 23,716
  • 9
  • 83
  • 122
0
votes
1 answer

Qml StateMachine KeyEventTransitions

QtWidgets has the QKeyEventTransition. Looks like theres no equivalent type in QML. How can I transit states based on a key event?
ManuelSchneid3r
  • 15,850
  • 12
  • 65
  • 103
0
votes
0 answers

How to get the previous QState with a QStateMachine?

I am currently implementing a QStateMachine. I know how to get the current state : bool MyClass::isSuccessState() const { return configuration().contains(successState); } However, I need to retrieve the previous QState. I know that it is…
Martin Denion
  • 352
  • 1
  • 3
  • 22
0
votes
1 answer

Can a QHistoryState remember the children state of a sibiling state?

In the State Machine Framework page on the QState machine, it talks about how QHistoryState works. A QHistoryState is instantiated as the child of another state, like in the example on the doc page: However, while this QHistoryState in the example…
isakbob
  • 1,439
  • 2
  • 17
  • 39
0
votes
0 answers

QStateMachine automatic transitions or mix boost::msm with QObject

I am pretty new to C++ and Qt and I want to develop a machine control and model the process via state machines. Up until now I separated my code into different QObjects running in different QThreads which communicate via QTs signal/slot concept. Up…
kain
  • 129
  • 1
  • 7
0
votes
0 answers

QStateMachine: transitions between all the states

I am developing a vector drawing application. I have a QStateMachine with 4 QStates: DefaultState, SelectionState, LineDrawingState, PolygonDrawingState. When the user clicks the appropriate tool button, the corresponding transition is triggered and…
ezpresso
  • 7,896
  • 13
  • 62
  • 94
0
votes
1 answer

How are managed the events in QStateMachine?

I work with a state machine based on QScxmlStateMachine. Some transitions are automatically triggered by code in the onEntry handlers, some others are triggered by external events (such as user click). The execution of the state machine is…
ymoreau
  • 3,402
  • 1
  • 22
  • 60
0
votes
1 answer

Subclassing and modifying QStateMachine

Let's say I have a pack of robots that run a QStateMachine. All state machines of those robots have the same basic structure: States: Sleep Search Destroy Return Transitions (from -> to on signal: Sleep -> Search on "next" Search -> Destroy…
0
votes
1 answer

QML scoping within StateMachine and State

I read the doc about QML scoping. By this doc the following is allowed (under Component Instance Hierarchy second example from the above doc): My StateMachine (BaseStateMachine.qml): import QtQuick 2.5 import QtQml.StateMachine 1.0 as…
Silex
  • 2,583
  • 3
  • 35
  • 59
0
votes
1 answer

QStateMachine get event causing state transition

I have created a QStateMachine and I have to get the Event which has caused a transition of the state. Isn't there any opportunity to get inside my slot EnterStateInit() the signal which caused this call. Here my sample code: CreateStateMachine() { …
Lehtim
  • 125
  • 1
  • 12
0
votes
1 answer

Explanation about QStateMachine delay function

I used this function in my program: void delay(QState * state1, int millisecond, QAbstractState * state2) { auto timer = new QTimer(state1); timer->setSingleShot(true); timer->setInterval(millisecond); QObject::connect(state1,…