[Interest] QJsonDocument::fromVariant failing with list

Thiago Macieira thiago.macieira at intel.com
Wed Jun 9 16:08:17 CEST 2021


On Wednesday, 9 June 2021 00:34:40 PDT Allan Sandfeld Jensen wrote:
> > QList is not a type, it's a template. Neither QVariant nor QJsonDocument
> > can know all possible QList instantiations. So they have coded only a few
> > (QVariantList and QStringList only, possibly QVector<QVariant> and
> > QVector<QString> in Qt 5 too, I don't remember).
> 
> I guess our system could detect QList<QVariant> as QVariantList and
> QList<QString> as QStringList. They should be binary identical anyway.

They already do.

The problem is QList of other things that it's not coded for, like 
QList<QVariantMap> in this case, or QList<int> or QList<bool>. Since JSON 
arrays are not expected to be homogeneous, QJsonDocument does not support 
them.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering





More information about the Interest mailing list