Commit f50acfff authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.MetaInfo: C++ class names might equal QML type names



If the C++ class name equals the QML type name we looked up the
CppComponentValue of the C++ class.
This one has no version information, which creates issues
in the item library.

As a solution we try to resolve the type as a C++ class as a last resort.
Any QML type has precedence.

Task-number: QTCREATORBUG-9422
Change-Id: Ia84663cab1b4011f1ef6494de86ea6d92ab74bef
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent ea3ac259
...@@ -567,11 +567,6 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons ...@@ -567,11 +567,6 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons
return 0; return 0;
const TypeName type = nameComponents.last(); const TypeName type = nameComponents.last();
// maybe 'type' is a cpp name
const QmlJS::CppComponentValue *value = context()->valueOwner()->cppQmlTypes().objectByCppName(type);
if (value)
return value;
TypeName module; TypeName module;
for (int i = 0; i < nameComponents.size() - 1; ++i) { for (int i = 0; i < nameComponents.size() - 1; ++i) {
if (i != 0) if (i != 0)
...@@ -579,7 +574,7 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons ...@@ -579,7 +574,7 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons
module += nameComponents.at(i); module += nameComponents.at(i);
} }
// otherwise get the qml object value that's available in the document // get the qml object value that's available in the document
foreach (const QmlJS::Import &import, context()->imports(document())->all()) { foreach (const QmlJS::Import &import, context()->imports(document())->all()) {
if (import.info.path() != QString::fromUtf8(module)) if (import.info.path() != QString::fromUtf8(module))
continue; continue;
...@@ -592,7 +587,14 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons ...@@ -592,7 +587,14 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons
return cppValue; return cppValue;
} }
return value_cast<CppComponentValue>(getObjectValue()); const QmlJS::CppComponentValue *value = value_cast<CppComponentValue>(getObjectValue());
if (value)
return value;
// maybe 'type' is a cpp name
const QmlJS::CppComponentValue *cppValue = context()->valueOwner()->cppQmlTypes().objectByCppName(type);
return cppValue;
} }
const QmlJS::ObjectValue *NodeMetaInfoPrivate::getObjectValue() const const QmlJS::ObjectValue *NodeMetaInfoPrivate::getObjectValue() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment