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
13
votes
5 answers

How to get this Qt state machine to work?

I have two widgets that can be checked, and a numeric entry field that should contain a value greater than zero. Whenever both widgets have been checked, and the numeric entry field contains a value greater than zero, a button should be enabled. I…
Ton van den Heuvel
  • 10,157
  • 6
  • 43
  • 82
12
votes
4 answers

C++ Qt: Check the current State of QStateMachine

I'm trying to implement a state-machine in Qt (C++). How can I check the current state of the QStateMachine? I couldn't find a method in the documentation. thx
tbienias
  • 629
  • 2
  • 7
  • 15
10
votes
2 answers

Qt State Machine Transition in a Layout

Well, I am developing a Qt application and I want use the Qt State Framework to make some animations. First: How I can animate a group of buttons contained in a horizontal layout, into another vertical layout, by using state a…
4
votes
1 answer

QStatemachine and parallel states

I'm going crazy with QStateMachine wth ParallelState. I've a main state (sequential) which contain a first state, a second state which contains a group of parallel states, and another state that is again sequential. The first state represent a…
D.Giunchi
  • 1,900
  • 3
  • 19
  • 23
4
votes
1 answer

Qt state machine: How to associate a single transition with multiple states

Question I am currently working on a application using Qt state machine framework, my objective is to associate a single transition with multiple source states. The rationale for doing it is the signal causing the transition is independent of the…
Vivek Maran
  • 2,623
  • 5
  • 38
  • 52
4
votes
0 answers

Implementing event transitions and guard conditions in Qt's QStateMachine

I'm trying to understand the usage of QStateMachine, specifically handling user events that trigger transitions. Additionally, I want to understand the best way to implement guards. I've drawn a state machine below. It's mostly sequential and not…
Rich von Lehe
  • 1,362
  • 2
  • 16
  • 38
4
votes
6 answers

How to design a state machine in face of non-blocking I/O?

I'm using Qt framework which has by default non-blocking I/O to develop an application navigating through several web pages (online stores) and carrying out different actions on these pages. I'm "mapping" specific web page to a state machine which I…
Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366
3
votes
0 answers

QStateMachine with QSignalTransition loses signal

i have a strange problem with QStateMachine, which i cannot solve for a week. Brief explanation: I use QStateMachine in my application for controlling of sending commands to a biomedical device, connected through COM port. The whole state machine is…
Michal
  • 1,955
  • 5
  • 33
  • 56
3
votes
1 answer

QStateMachine: Difference between QEvent and Signal?

I'm currently porting a small application from PyGTK to PySide which sits in your systray and periodically checks a server for updates. When I initially wrote this, I used a custom state model to represent its behaviour: init: initial…
Sebastian
  • 1,055
  • 9
  • 27
3
votes
1 answer

How to implement QStateMachine state transition actions? QSignalMapper?

I am building a program with a largely sequential flow but also some alternative paths. I thought that a state machine might be the simplest way of implementing this since Qt provides such a class: QStateMachine (also see API). However, I seem to…
handle
  • 5,859
  • 3
  • 54
  • 82
2
votes
1 answer

How do you implement a choice in a state machine in Qt?

Imagine a part of your state machine looks like this: How do you properly implement the choice part in Qt? I know there are guarded transitions, but that would mean that I need to: Create a subclass of a QAbstractTransition which accepts e.g. an…
Tim Meyer
  • 12,210
  • 8
  • 64
  • 97
2
votes
1 answer

How can I terminate QStateMachine when QDialog is closed?

I have a QDialog and QStateMachine. This loop terminates when the all aplication is closed but i want to terminate loop when Qdialog is closed. How can i do that? QStateMachine sm; QState s1(&sm), s2(&sm); sm.setInitialState(&s1); …
EmreS
  • 159
  • 1
  • 3
  • 15
2
votes
2 answers

Emitting signals from class, if transition in QStateMachine was successful

My problem is the following: I need to create class, which contains QStateMachine instance. This class should have slots through which you could "ask" state machine to make transition to another state. And if transition was successful, my class…
2
votes
2 answers

How to test a QStateMachine?

I'm a bit confused about how to test a QStateMachine. I have a project well organized with source code in one side and test code on the other side. header class Foo { signals: void sigGoToStateOne(); void sigGoToStateTwo(); …
Martin
  • 877
  • 8
  • 20
2
votes
1 answer

how to use a custom signal with QStateMachine addtransition

'm trying to figure out how to use my own custom signals in combination with QStateMachine. I started with a simple example from here. Now I'm trying to create a new signal mysignal and trigger a transition off of it. But I can't figure out how to…
gggg
  • 2,284
  • 1
  • 17
  • 19
1
2 3 4