Qt State Machine

Qt 6 的改动是有意识地使框架更高效、更易用的结果。

我们努力在每个版本中保持所有公共 API 的二进制和源代码兼容性。但为了使 Qt 成为一个更好的框架,有些改动是不可避免的。

在本专题中,我们总结了Qt State Machine 模块中的这些变化,并提供了处理这些变化的指导。

变化

一般来说,QtStateMachine 模块的源代码与 Qt5 版本兼容,该库的用户应能继续使用,无需或只需对其项目进行少量改动。

QSignalTransition

QSignalTransition::senderObject() getter 和相关的Q_PROPERTY 现在也使用 constQObject*。现在,它们与以 constQObject* 为参数的 setterQSignalTransition::setSenderObject(const QObject*) 更为一致。

构建系统

与 Qt 6 一样,除了 qmake 之外,Qt State Machine 模块还支持 cmake。

QML 导入

除非有特殊原因不使用最新版本,否则 QML 导入版本是可选的。一般来说,版本控制的导入从 5.8 到 6.x,其中 "x "是当前的次版本。

© 2025 The Qt Company Ltd. 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.