From 02c484a343949ec79adaf80c72ed4f3452052237 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 16 Oct 2013 17:36:19 +0200 Subject: [PATCH] QmlDesigner.MetaInfo: fix handling of enum scopes The codel model does not provide enum scopes at the moment. As a fallback we use class names, but this fails if we use the original cpp class name from the package. For this reason we always try to find an export with a package different from . As a final solution the code model should be able to provide the enum scopes. Task-number: QTCREATORBUG-10114 Change-Id: I15396c83590426ab0b9b55c8646a89c8d5712683 Reviewed-by: Fawzi Mohamed --- .../designercore/metainfo/nodemetainfo.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 750f9a3624a..000176d2075 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -40,6 +40,7 @@ #include #include #include +#include namespace QmlDesigner { @@ -775,8 +776,20 @@ QString NodeMetaInfoPrivate::propertyEnumScope(const PropertyName &propertyName) return QString(); const CppComponentValue *definedIn = 0; qmlObjectValue->getEnum(propertyType(propertyName), &definedIn); - if (definedIn) + if (definedIn) { + QString nonCppPackage; + foreach (const LanguageUtils::FakeMetaObject::Export &qmlExport, definedIn->metaObject()->exports()) { + if (qmlExport.package != QLatin1String("")) + nonCppPackage = qmlExport.package; + } + + const LanguageUtils::FakeMetaObject::Export qmlExport = + definedIn->metaObject()->exportInPackage(nonCppPackage); + if (qmlExport.isValid()) + return qmlExport.type; + return definedIn->className(); + } return QString(); }