aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp')
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp b/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp
index 4fa4a8b82b..467870a579 100644
--- a/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmltextgenerator.cpp
@@ -111,11 +111,21 @@ QString QmlTextGenerator::toQml(const AbstractProperty &property, int indentDept
if (property.name() == "id")
return stringValue;
- if (false) {
- }
- if (variantProperty.parentModelNode().metaInfo().isValid() &&
- variantProperty.parentModelNode().metaInfo().propertyIsEnumType(variantProperty.name())) {
- return variantProperty.parentModelNode().metaInfo().propertyEnumScope(variantProperty.name()) + '.' + stringValue;
+ if (variantProperty.parentModelNode().metaInfo().isValid()
+ && variantProperty.parentModelNode().metaInfo().propertyIsEnumType(variantProperty.name())) {
+ return variantProperty.parentModelNode().metaInfo().propertyEnumScope(variantProperty.name())
+ + QLatin1String(".") + stringValue;
+ //Enums do not work with alias properties. This is a workaround.
+ } else if (variantProperty.parentModelNode().metaInfo().isValid()
+ //Enums are not strings
+ && variantProperty.parentModelNode().metaInfo().propertyTypeName(variantProperty.name())
+ != ("string")
+ && variantProperty.parentModelNode().metaInfo().propertyTypeName(variantProperty.name())
+ != ("QString")
+ //We check if the value of the property is one of the known Qt Quick enums.
+ && NodeMetaInfo::qtQuickEnumsWithoutScope().contains(stringValue)
+ ) {
+ return NodeMetaInfo::qtQuickEnumScopeForEnumString(stringValue) + QLatin1String(".") + stringValue;
} else {
switch (value.type()) {