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 name 自變量按 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.