I have a an object I\'d like to be able to read and write to/from a QDataStream. The header is as follows:
class Compound
{
public:
Compound(QString, QPi
If you want to overload the "extract" operator >>, your signature must be:
QDataStream & operator >> (QDataStream & in, MyClass & class);
Hope it helps.
I think you've answered your own question! The stream operator
QDataStream& operator<<( QDataStream&, const Compound& )
will work fine. In the implementation you just use the existing stream operators on QDataStream
to serialise the individual bits of your Compound
. Some Qt classes define non-member QDataStream
operators too. QString
is one and so is QList
so it looks like you're sorted!