Commit e69bb933 authored by Marco Benelli's avatar Marco Benelli

qmljs: set cpp object to the latest version exported

m_objectsByQualifiedName did not prefer the latest meta object
revision, as consequence at type exported both anonymously and with a
name, would pick up one version randomly.

Change-Id: I91baf2729d0a0bda61205a62d9a38d04b4da058e
Reviewed-by: default avatarErik Verbruggen <>
parent 68f6eec4
......@@ -1487,6 +1487,7 @@ QList<const CppComponentValue *> CppQmlTypes::createObjectsForImport(const QStri
if (m_objectsByQualifiedName.contains(key))
ComponentVersion cppVersion;
foreach (const FakeMetaObject::Export &bestExport, bestExports) {
QString name = bestExport.type;
bool exported = true;
......@@ -1501,7 +1502,10 @@ QList<const CppComponentValue *> CppQmlTypes::createObjectsForImport(const QStri
// use package.cppname importversion as key
m_objectsByQualifiedName.insert(key, newComponent);
if (cppVersion <= bestExport.version) {
cppVersion = bestExport.version;
m_objectsByQualifiedName.insert(key, newComponent);
if (exported) {
if (!exportedObjects.contains(name) // we might have the same type in different versions
|| (newComponent->componentVersion() > exportedObjects.value(name)->componentVersion()))
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment