本页内容

变更内容Qt State Machine

Qt 6 的变更,是出于让框架更高效、更易于使用的有意识努力。

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

在本主题中,我们总结了Qt State Machine 模块中的这些变更,并提供了相应的处理指南。

变更

总体而言,QtStateMachine 模块与 Qt5 版本在源码层面兼容,该库的用户应能继续使用,无需对项目进行任何更改或仅需进行微调。

QSignalTransition

QSignalTransition::senderObject() 获取器以及相关的Q_PROPERTY 现在也使用 constQObject*。这与将 constQObject* 作为参数的设置器QSignalTransition::setSenderObject(const QObject*) 更加一致。

构建系统

与 Qt 6 的整体情况一致,Qt State Machine 模块除了支持 qmake 之外,还支持 cmake。

QML 导入

除非有特殊原因不使用最新版本,否则 QML 导入的版本号是可选的。一般而言,带版本号的导入在 5.8 到 6.x 版本之间均有效,其中“x”代表当前的小版本号。

© 2026 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.