diff options
author | Dominik Holland <dominik.holland@qt.io> | 2020-01-17 12:24:06 +0100 |
---|---|---|
committer | Dominik Holland <dominik.holland@qt.io> | 2020-01-21 16:03:09 +0100 |
commit | 45317b232c926276555f8dc100be21988ea46405 (patch) | |
tree | 41a793f540f18911622836d97301bfff4a19a626 /src/ivicore | |
parent | 895d5505bb74148a4464947b31bfdbb4c11f5637 (diff) | |
download | qtivi-45317b232c926276555f8dc100be21988ea46405.tar.gz |
simulation: Fix struct initialization using JSON dictionaries
Instead of using a list of values to fill all members, it is also possible
to use a dictionary, which is more expressive.
This fixes the conversion function and adds an autotest for it.
Change-Id: I7b817a26622f95c7e9fe4d3ff853310c5ad87f32
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
Diffstat (limited to 'src/ivicore')
-rw-r--r-- | src/ivicore/qiviqmlconversion_helper.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/ivicore/qiviqmlconversion_helper.cpp b/src/ivicore/qiviqmlconversion_helper.cpp index f73eb41..2b13b7c 100644 --- a/src/ivicore/qiviqmlconversion_helper.cpp +++ b/src/ivicore/qiviqmlconversion_helper.cpp @@ -143,10 +143,6 @@ QVariant qtivi_convertFromJSON(const QVariant &value) return QVariant(); } - QVariantList values = value.toList(); - for (auto i = values.begin(); i != values.end(); ++i) - *i = qtivi_convertFromJSON(*i); - void *gadget = QMetaType::create(typeId); if (!Q_UNLIKELY(gadget)) { qWarning("Couldn't create a new instance of %s", QMetaType::typeName(typeId)); @@ -167,7 +163,7 @@ QVariant qtivi_convertFromJSON(const QVariant &value) return QVariant(); } - mo->method(moIdx).invokeOnGadget(gadget, Q_ARG(QVariant, QVariant(values))); + mo->method(moIdx).invokeOnGadget(gadget, Q_ARG(QVariant, QVariant(value))); return QVariant(typeId, gadget); } } |