[Development] QVariant container API
Vasily Pupkin
shkodindanil.letmework at gmail.com
Mon Apr 1 15:44:28 CEST 2019
> By the way, conversions through QVariant are *exactly* what I implemented
in
> the examples/corelib/serialization/convert tool.
Right, I've seen these to be helpful.
The global task would allow to code like this.
~
struct MyStruct
{
int property1;
QString property2;
};
class MyObject
{
Q_OBJECT
...
public slots:
void mySlot(const QList<MyStruct>& value);
}
QJsonDocument doc(...);
QMetaMethod mySlot(...);
JsonDeserializer deserializer;
QVariant parameter;
if(deserializer.deserialize(doc, mySlot.paremeterType(0), parameter)
invoke(...);
else
{
//error
}
~
The only difference from examples, is that library user specifies, what
datatype should be produced. This would alllow to significantly reduce the
amount of boilerplate code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20190401/516bde58/attachment.html>
More information about the Development
mailing list