[Development] QVariant container API
Arnaud Clère
arnaud.clere at minmaxmedical.com
Wed Apr 3 15:35:32 CEST 2019
In your examples, you know the destination types statically so my suggestion did not seem off-topic.
Cheers
From: Vasily Pupkin <shkodindanil.letmework at gmail.com>
To: Arnaud Clère <arnaud.clere at minmaxmedical.com>
> Using QVariant as an intermediate data structure is not optimal to read/write your QList<MyStruct>
> It also prevents from directly using the QList<MyStruct> type to guide the deserialization. In QBind you do not need to register types at runtime and you avoid losing data silently (instead you have static_asserts complaining at compile time).
The whole idea, is to provide (de)serialization mechanism in scenarios, when one cannot know the type staticaly, but can get it dynamicaly in a statically typed language. In general one has to provide a void pointer and type enumeration. But Qt already happens to have rich type information, while C++ trails a bit. And that is QVariant+QMetaType.
The only thing in cannot do right now is operating on containers. And that's what I wanted to discuss.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190403/bdcb9067/attachment.html>
More information about the Development
mailing list