Hi,
I have a problem in qt list serialization.
I am getting error no match for operator '>>' in s '>>' t (from qdatastream.h). I also tried declaring meta but not use.
class CustomClass
{
{
out<<myClass.name;
return out;
}
QDataStream &operator>>
(QDataStream
& in,CustomClass
& myClass
) {
in>>myClass.name;
return in;
}
}
Q_DECLARE_METATYPE(CustomClass*);
class CustomClass2
{
QList<CustomClass> list;
{
out<<myClass.list;
return out;
}
QDataStream &operator>>
(QDataStream
& in,CustomClass2
& myClass
) {
in>>myClass.list;
return in;
}
};
class CustomClass
{
QString name;
QDataStream &operator<<(QDataStream &out, const CustomClass& myClass)
{
out<<myClass.name;
return out;
}
QDataStream &operator>>(QDataStream& in,CustomClass& myClass)
{
in>>myClass.name;
return in;
}
}
Q_DECLARE_METATYPE(CustomClass*);
class CustomClass2
{
QList<CustomClass> list;
QDataStream &operator<<(QDataStream &out, const CustomClass2& myClass)
{
out<<myClass.list;
return out;
}
QDataStream &operator>>(QDataStream& in,CustomClass2& myClass)
{
in>>myClass.list;
return in;
}
};
To copy to clipboard, switch view to plain text mode
Without the meta tag declaration 'Q_DECLARE_METATYPE(CustomClass*);'. it says no match for operator '>>' and '<<' myClass.list
Please help.
Development in,
Qt SDK for Nokia
Bookmarks