You must create your own streaming operators for the class - otherwise there's no ability for another body of code to automatically determine how to construct/de-construct your class.
E.g.:
Q_DECLARE_METATYPE(MyClass)
inline QDataStream& operator<<(QdataStream& out, const MyClass& in) {
out << quint32(in.foo());
out << quint32(in.bar());
return out;
}
inline QDataStream& operator>>(QdataStream& in, const MyClass& out) {
quint32 foo;
quint32 bar;
in >> foo;
in >> bar;
out.setFoo(foo);
out.setBar(bar);
return in;
}
Q_DECLARE_METATYPE(MyClass)
inline QDataStream& operator<<(QdataStream& out, const MyClass& in) {
out << quint32(in.foo());
out << quint32(in.bar());
return out;
}
inline QDataStream& operator>>(QdataStream& in, const MyClass& out) {
quint32 foo;
quint32 bar;
in >> foo;
in >> bar;
out.setFoo(foo);
out.setBar(bar);
return in;
}
To copy to clipboard, switch view to plain text mode
See also: http://stackoverflow.com/questions/2...zation-with-qt
Bookmarks