对Qt D-Bus
Qt 6 的改动是有意识地使框架更高效、更易用的结果。
我们尝试在每个版本中保持所有公共 API 的二进制和源代码兼容性。但为了使 Qt 成为一个更好的框架,有些改动是不可避免的。
在本主题中,我们将总结 Qt DBus 中的这些变化,并提供处理这些变化的指导。
API 变化
QtDBus 模块进行了一些基本的合并和清理。要切换到 Qt6,移植工作应该是最小的。
QDBusMessage 类
Qt6 中删除了参数大小固定的 QDBusMessage::call() 和 QDBusMessage::asyncCall() 方法。
QDBusArgument 类
用于QHash 、QMap 和QList 的 QDBusArgument::operator<<() 特殊化已统一为用于关联容器的通用特殊化。
QDBusConnection 类
Qt6 中删除了 QDBusConnection::sender() 函数。
QDBusMessage 类
QDBusMessage::createErrorReply() 函数现在通过常量引用获取QString name
参数,而不是通过值获取。
QDBusPendingReply 类
QDBusPendingReply 类已改为可变模板类,以便支持超过 8 个模板参数。模板参数是用于提取回复数据内容的类型。
© 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.