Qt D-Bus 的变化

Qt 6 是努力使框架更高效,且更易于使用的结果。

为兼容每个发行的所有公共 API,我们试着维护二进制和源代码。但是,为使 Qt 成为更优框架,一些改变是不可避免的。

在此话题中,我们汇总了那些 Qt DBus 变化,并提供处理它们的指导。

API 变化

The QtDBus module has undergone some basic consolidation and cleanup. There should be minimal porting effort to be able to switch to Qt6.

The QDBusMessage class

The QDBusMessage::call() and QDBusMessage::asyncCall() methods with a fixed size of arguments have been removed in Qt6.

The QDBusArgument class

The QDBusArgument::operator<<() specializations for QHash , QMap and QList have been unified into common specializations for associative containers.

The QDBusConnection class

QDBusConnection::sender() 函数已在 Qt6 被删除。

The QDBusMessage class

The QDBusMessage::createErrorReply () 函数现在接受 QString 名称 自变量按 const 引用而不是接受值。

The QDBusPendingReply class

QDBusPendingReply has been changed to be a variadic template class in order to support more than 8 template parameters now. The template parameters are the types that will be used to extract the contents of the reply's data.