aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/language/evaluatorscriptclass.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-03-12 15:37:59 +0100
committerChristian Kandeler <christian.kandeler@qt.io>2018-03-13 08:57:34 +0000
commit5e5a71fef37fb64718aa17593dd909aabb784632 (patch)
tree92aca3ec6ca91173ca697ae9657f6d8babde466a /src/lib/corelib/language/evaluatorscriptclass.cpp
parentc6f0044d74fc6cbf6076d1f1c80b179a8067e387 (diff)
Add new property type "varList"
While we could already assign arrays to variant properties, these would not have list semantics when merging modules, so this fills a gap in our type system. [ChangeLog] Added new property type "varList". Change-Id: I54581119f60582f2b11290e13cd4920fd72f55a1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/language/evaluatorscriptclass.cpp')
-rw-r--r--src/lib/corelib/language/evaluatorscriptclass.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/corelib/language/evaluatorscriptclass.cpp b/src/lib/corelib/language/evaluatorscriptclass.cpp
index 5a0eec865..3c276956f 100644
--- a/src/lib/corelib/language/evaluatorscriptclass.cpp
+++ b/src/lib/corelib/language/evaluatorscriptclass.cpp
@@ -131,7 +131,8 @@ private:
= itemOfProperty->propertyDeclaration(propertyName->toString()).type();
const bool isArray = type == PropertyDeclaration::StringList
|| type == PropertyDeclaration::PathList
- || type == PropertyDeclaration::Variant;
+ || type == PropertyDeclaration::Variant // TODO: Why?
+ || type == PropertyDeclaration::VariantList;
QScriptValue valueToSet = scriptValue;
if (isArray) {
if (!valueToSet.isValid() || valueToSet.isUndefined())
@@ -561,6 +562,13 @@ static void convertToPropertyType_impl(const QString &pathPropertiesBaseDir, con
}
break;
}
+ case PropertyDeclaration::VariantList:
+ if (!v.isArray()) {
+ QScriptValue x = v.engine()->newArray(1);
+ x.setProperty(0, v);
+ v = x;
+ }
+ break;
}
}