Open arietto opened 4 years ago
When I have embedded QVariant child
, I put some dummy conversion function, then serialization succeeds (surely, with dummy value instead of actual data).
QString Gadget2QString(const Gadget& gadget)
{
return "dummy";
}
//just for example
std::function<QString(const Gadget&)> f = &Gadget2QString;
QMetaType::registerConverter<Gadget, QString>(f);
So, I suppose that CBOR limitation (QVariant ->CBOR conversion fails for custom types) gives headache.
Hello! I am trying to serialize
Q_GADGET
struct (My_gadget
). It containsQVariantList children
. These children areQVariant
values which encapsulateMy_gadget
. The corresponding property is not serialized (it's a pity). If i change toQVariant child
, then it fails too. What is the workaround? In real project QVariantList will contain otherQ_GADGETs
too.P.S. AFAIK, CBOR is used internally in this serializer even if I need JSON.
Q_GADGET
struct fails to convert toQCBorValue
viaQVariant
wrapper, becauseQVariant::toString()
returns empty string.