Commit 4f2d5fdcc0fc7743206463995ffe3f1872019ebf
1 parent
b2b9273c
added logic to parse QVariantLists
Showing
1 changed file
with
4 additions
and
2 deletions
openbr/openbr_plugin.cpp
| ... | ... | @@ -804,7 +804,7 @@ void Object::setProperty(const QString &name, QVariant value) |
| 804 | 804 | int v = value.toInt(&ok); |
| 805 | 805 | if (ok) |
| 806 | 806 | value = v; |
| 807 | - } else if ((type.startsWith("QList<") && type.endsWith(">")) || (type == "QStringList")) { | |
| 807 | + } else if ((type.startsWith("QList<") && type.endsWith(">")) || (type == "QStringList") || (type == "QVariantList")) { | |
| 808 | 808 | QVariantList elements; |
| 809 | 809 | if (value.canConvert<QVariantList>()) { |
| 810 | 810 | elements = value.value<QVariantList>(); |
| ... | ... | @@ -821,7 +821,9 @@ void Object::setProperty(const QString &name, QVariant value) |
| 821 | 821 | qFatal("Expected a list."); |
| 822 | 822 | } |
| 823 | 823 | |
| 824 | - if ((type == "QList<QString>") || (type == "QStringList")) { | |
| 824 | + if ((type == "QList<QVariant>") || (type == "QVariantList")) { | |
| 825 | + value.setValue(elements); | |
| 826 | + } else if ((type == "QList<QString>") || (type == "QStringList")) { | |
| 825 | 827 | QStringList parsedValues; |
| 826 | 828 | foreach (const QVariant &element, elements) |
| 827 | 829 | parsedValues.append(element.toString()); | ... | ... |