Hi,
Here's the demo code:
QList<Custom> L;
QVariant v(QVariant::fromValue(l));
QDataStream d;
d << v;
The problem seems to be that d doesn't know how to stream v, because v doesn't know how to do a metatype save on L. I have registered Custom and L as metatypes and I've also registered their IO streams, but L has no meta object, and I think that is the problem.
Can I get around this somehow?
Later edit:
After debugging the QMetaType code, I've found out that when calling qRegisterMetaTypeStreamOperators<Type>("TypeString")
"TypeString" must be "Type", not just any string. This was mentioned in the docs, but it's not really clear. The QtCentre link also mentioned this. I've decided to accept Kaleb Pederson's answer because it is my fault that I found the answer the hard way. :)