PDA

View Full Version : Finite state machine editor using QWidgets



mut
21st June 2014, 03:16
Hello;

I need to write an editor (similar to Microsoft Visio) allowing the drawing of a hierarchical finite state machine and eventually generate the structure of the state machine into a XML. I have the following requirements:
- State: a clickable, highlightable, drag and drop resizable rectangle. A text (the state name) shall be displayed inside the rectangle at the top leaving the center empty for an eventual substate.
- A Substate: just a state inside a state
- Transition: a line joining two states. A text (the event name corresponding to the transition) shall be displayed along the line.

The State, Substate and Transition will reside in a toolbox and will be dragged into a drawing area and drop there by the user.

Should I use Graphics Items?

Any sample code and pointers to good links?

My requirement is to stick to Qt Widgets.

Thanks;

Mut.

anda_skoa
21st June 2014, 12:20
Yes, that does sound a lot like a use case for QGraphicsView

On the topic of state machine editors: at the recent Qt contributor summit there was talk about such a thing becoming available soon, even integrated in some way into QtCreator as far as I understand.

Cheers,
_

mut
22nd June 2014, 21:46
Hello;

Thank you for the reply. Any chance that you have the link to that talk and the author.

Mut.

anda_skoa
23rd June 2014, 08:41
Thank you for the reply. Any chance that you have the link to that talk and the author.


Unfortunately not, but it might have also been discussed on the Qt Creator or Qt development mailing list.

It might also appear in the QtCreator&Tooling meeting minutes at some point

https://etherpad.wikimedia.org/p/Qs2014QtCretorTooling

Cheers,
_

anda_skoa
25th June 2014, 08:29
This could be interesting to you https://github.com/KDAB/KDStateMachineEditor

Cheers,
_