What's wrong with the following snippet? I am constantly getting the error
Unexpected reply signature: got "a{sa{sv}}", expected "" (QMap<QString,QVariantMap>)
QDBusInterface connIface(
NM_DBUS_SERVICE,
"/org/freedesktop/NetworkManager/Settings/1",
NM_DBUS_INTERFACE_SETTINGS_CONNECTION,
QDBusConnection::systemBus());
QDBusReply<QMap<QString, QMap<QString, QVariant>> > settingsResult = connIface.call("GetSettings");
I really don't get it, seems to be perfectly fine to me. Is it possible that this has to do with the compiler / header-versions somehow?
CodePudding user response:
You have to register the expected Response first!
In my case it was like
#include <QtDBus/QDBusMetaType>
// ...
typedef QMap<QString, QMap<QString, QVariant> > ConnectionDetails;
Q_DECLARE_METATYPE(ConnectionDetails)
and
int main() {
qDBusRegisterMetaType<ConnectionDetails>();
// ...
}