I have a problem in extracting the returned value from a method called on DBus,
here is my code:
QDBusPendingReply <QDBusObjectPath> reply = m_sysroot->GetOS(QStringLiteral("fedora"));
reply.waitForFinished();
if(! reply.isError()){
qWarning() << "No Error" << Qt::endl;
qWarning() << reply.argumentAt(0)<<Qt::endl;
}
else{
qWarning() <<"Error occurs" << Qt::endl;
}
here is the defination of GetOS:
<method name="GetOS">
<arg name="name" type="s"/>
<arg name="object_path" type="o" direction="out"/>
</method>
The output of the code is:
No Error
QVariant(QDBusObjectPath, )
How to get the object path ?? thanks
I have solved the problem by adding these 2 lines:
QDBusObjectPath objectPath = reply.argumentAt(0).value<QDBusObjectPath>();
qWarning() << objectPath.path() << Qt::endl;