From b7eafe9512ce448719b15fc3f337c8b5717bb93a Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 7 Jan 2016 12:55:39 +0100 Subject: [PATCH] QmlDesigner: Ensure that QQuickItem is always used from the QtQuick export The code model creates multiple exports for QQuickItem, but to be able to identify it as QtQuick.Item we have to always use the QtQuick export. Change-Id: Ife567cfb368092f818c7cf418ede4ab1bca227fa Reviewed-by: Alessandro Portale Reviewed-by: Tim Jenssen --- .../designercore/metainfo/nodemetainfo.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 493f762afd6..be3320c661b 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -751,6 +751,21 @@ const CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() const // maybe 'type' is a cpp name const CppComponentValue *cppValue = context()->valueOwner()->cppQmlTypes().objectByCppName(type); + if (cppValue) { + foreach (const LanguageUtils::FakeMetaObject::Export &exportValue, cppValue->metaObject()->exports()) { + if (exportValue.package.toUtf8() != "") { + foreach (const QmlJS::Import &import, context()->imports(document())->all()) { + if (import.info.path() != exportValue.package) + continue; + const Value *lookupResult = import.object->lookupMember(exportValue.type, context()); + const CppComponentValue *cppValue = value_cast(lookupResult); + if (cppValue) + return cppValue; + } + } + } + } + return cppValue; }