Conversion of std::string to qstring over Qdbus and Provide QDBusArgument streaming operators
-
Hi All,
I have a C++ application exposing methods which have structures with std:string as parameter.
I would like to access these through Qtbus in my Qt application.
Please let me know how do i write Provide QDBusArgument streaming operators (<< and >> definition) -
One possibility is using "fromStdString":http://developer.qt.nokia.com/doc/qt-4.8/qstring.html#fromStdString for conversion.
-
I tried the folloing
@
const QDBusArgument &operator>>(const QDBusArgument &argument, abc &myabc) {
argument.beginStructure();
QString tempstr;
argument >> tempstr >> myabc.availability;
myabc.name=QString::toStdString(tempstr);
argument.endStructure();
return argument;
}
@
I get the below error
no matching function for call to ‘QString::toStdString(QString&) -
Basic C++ error. toStdString is not a static method.
@
myabc.name = tempstr.toStdStr();
@