创建状态图
您可以使用Qt Creator 创建嵌入状态机的应用程序。文件向导会创建带有模板代码的状态图 XML (SCXML)文件,你可以使用 SCXML 编辑器对其进行编辑。您可以使用 Qt SCXML模块中的类,在 Qt 应用程序中嵌入从文件创建的状态机。
创建状态图
- 选择File >New File >Files and Classes >Modeling >State Chart >Choose ,创建一个空的状态图,并在 SCXML 编辑器中打开它。
- 将一个状态从Common States 视图 (1) 拖到状态编辑器 (2)。
- 将子状态拖到初始状态以创建复合状态,或使用工具按钮 (3) 从选定状态及其目标状态创建过渡。
- 在编辑器或Structure 视图 (5) 中选择一个状态,在Attributes 视图 (6) 中编辑其属性。
- 选择过渡线 (4) 以添加边缘点。
- 例如,要引发或发送事件,可使用上下文菜单命令将可执行内容添加到状态的
<onentry>
和<onexit>
元素或过渡中。
另请参阅 SCXML 编辑器。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.