[Development] QVariant container API

Vasily Pupkin shkodindanil.letmework at gmail.com
Mon Apr 1 12:50:18 CEST 2019


> You can be sure that the conversion from QList<int> to
QSequentialIterable
> will be successful, but the other way around is not given.
QSequentialIterable
> can contain QVariants of different types. I'm curious what is the use
case for
> the feature?

Imagine one could call a Q_INVOKABLE or a slot given QJsonDocument. The
approach is to get parameter type ids, to make deserializations into
QVariant instances and to invoke.
This becomes non-trivial for container types of arbitary element types.

> I think it could be implemented by extending:
> https://code.woboq.org/qt5/qtbase/src/corelib/kernel/qmetatype.h.html#2306
> which registers conversion from a container to QSequentialIterable. You
could
> add the opposite function. That way no binary compatibility would be
broken
> nor major re-factoring would be needed.

That's right. This solution works exactly like you suggest
https://github.com/Skycoder42/QtJsonSerializer . I am seeking for a way of
eliminating a need of registering types and converters.

> Sure, try, you can add me to review :-)

Great! Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190401/cdea4d93/attachment.html>


More information about the Development mailing list