summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@digia.com>2013-10-16 17:36:19 +0200
committerThomas Hartmann <Thomas.Hartmann@digia.com>2013-10-16 19:21:02 +0200
commit02c484a343949ec79adaf80c72ed4f3452052237 (patch)
treebb02a70e422b3952059edadeade4012666d943aa
parenta6d6db3397b82dc9fca5517c3ad2595f00c89f90 (diff)
downloadqt-creator-02c484a343949ec79adaf80c72ed4f3452052237.tar.gz
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 <cpp> package. For this reason we always try to find an export with a package different from <cpp>. 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 <fawzi.mohamed@digia.com>
-rw-r--r--src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
index 750f9a3624..000176d207 100644
--- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
+++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
@@ -40,6 +40,7 @@
#include <qmljs/qmljsscopechain.h>
#include <qmljs/parser/qmljsast_p.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
+#include <languageutils/fakemetaobject.h>
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("<cpp>"))
+ nonCppPackage = qmlExport.package;
+ }
+
+ const LanguageUtils::FakeMetaObject::Export qmlExport =
+ definedIn->metaObject()->exportInPackage(nonCppPackage);
+ if (qmlExport.isValid())
+ return qmlExport.type;
+
return definedIn->className();
+ }
return QString();
}