forked from qt-creator/qt-creator
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: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
@@ -567,11 +567,6 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons
|
||||
return 0;
|
||||
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;
|
||||
for (int i = 0; i < nameComponents.size() - 1; ++i) {
|
||||
if (i != 0)
|
||||
@@ -579,7 +574,7 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons
|
||||
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()) {
|
||||
if (import.info.path() != QString::fromUtf8(module))
|
||||
continue;
|
||||
@@ -592,7 +587,14 @@ const QmlJS::CppComponentValue *NodeMetaInfoPrivate::getCppComponentValue() cons
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user