QM  7.0.0
Model-Based Design Tool
Loading...
Searching...
No Matches
Working with Statecharts

State MachinesWorking with States

Adding a Statechart

In the Model Explorer right-click on the Class to which you want to add the state machine and select Add State Machine from the popup menu.

Adding a State Machine to a Class
Note
The Add State Machine menu option is only available if a given class directly or indirectly inherits the QP class QHsm. Otherwise the option is "grayed-out".

Resizing a State Machine Diagram

As shown in the screen shot below, you can easily resize the Drawing Canvas of a State Diagram by dragging its right or bottom edges, or by dragging the resize handle in the bottom-right corner of the canvas. In each case the mouse cursor indicates the possible direction of resizing.

Resizing the Drawing Canvas

Statechart Property Sheet

Statechart items can be configured by the Statechart-Specific Property Sheet.

Statechart Property Sheet

The statechart-item property sheet contains the following properties:

QS_FUN_DICT

Checkbox that turns on/off the automatic generation of the QS_FUN_DICTIONARY()↑ macros for all states of a given statechart. The dictionary macros are generated in the top-most initial transition of the statechart. Below is an example of generated code with the QS_FUN_DICTIONARY() macros:

/*${SMs::Calc::SM} .........................................................*/
static QState Blinky_initial(Blinky * const me, void const * const par) {
/*.${AOs::Blinky::SM::initial} */
(void)par; /* unused parameter */
. . .
QS_FUN_DICTIONARY(&Blinky_off);
QS_FUN_DICTIONARY(&Blinky_on);
return Q_TRAN(&Blinky_off);
}

Documentation

The documentation entry in the Statechart Property Sheet allows you to provide documentation to the statechart. The QM code generator parses the documentation entry and can generate comments for the top-most initial transition of this statechart.

State MachinesWorking with States