> Sent: Wednesday, June 09, 2021 at 3:34 AM
> From: "Allan Sandfeld Jensen" <[email protected]>
> To: [email protected]
> Cc: "Thiago Macieira" <[email protected]>
> Subject: Re: [Interest] QJsonDocument::fromVariant failing with list
>
> On Dienstag, 8. Juni 2021 23:47:50 CEST Thiago Macieira wrote:
> > On Tuesday, 8 June 2021 13:57:53 PDT Jason H wrote:
> > > Which is neiher what I acually had but performs the same bad conversion as
> > > what I had. I am not sure why the QVariantList vs QList have different
> > > fidelity - the one with more fidelity - QList - actually has has less
> > > specificity.
> >
> > Because that's how C++ works.
> >
> > 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.

That is what I was expecting. I thought they were just a typedef? (Though I am 
lying there, I know QStringList inherits from QList<QString>) The instant case 
of QList<QVariant> is just a typedef though, so I am confused as why it wasn't 
working. I thought typedefs were indistinguishable?  The expressiveness of 
C++11 initializers of creating objects that end up in CBOR and JSON for I/O, 
and QVariant based trees (incl arrays) for in-app databases is just awesome. 
But then you get someone wielding C++ clumsily like me. :-)


I attempted to summarize and filed https://bugreports.qt.io/browse/QTBUG-94371


_______________________________________________
Interest mailing list
[email protected]
https://lists.qt-project.org/listinfo/interest

Reply via email to