diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp
index 47353fe135e1e3c036dae5f58dc1cedf26ff0a9d..e0d1801701002e3d14fba8bc945922c2ad07842c 100644
--- a/src/libs/qmljs/qmljsinterpreter.cpp
+++ b/src/libs/qmljs/qmljsinterpreter.cpp
@@ -858,8 +858,12 @@ const Value *QmlObjectValue::propertyValue(const FakeMetaProperty &prop) const
 
     // ### Verify type resolving.
     QmlObjectValue *objectValue = engine()->cppQmlTypes().typeForImport(typeName);
-    if (objectValue)
+    if (objectValue) {
+        QString packageClassName = objectValue->nameInPackage(packageName());
+        if (!packageClassName.isEmpty())
+            objectValue = engine()->cppQmlTypes().typeForImport(packageName() + '.' + packageClassName);
         return objectValue;
+    }
 
     const Value *value = engine()->undefinedValue();
     if (typeName == QLatin1String("QByteArray")
@@ -910,6 +914,14 @@ const Value *QmlObjectValue::propertyValue(const FakeMetaProperty &prop) const
 QString QmlObjectValue::packageName() const
 { return _packageName; }
 
+QString QmlObjectValue::nameInPackage(const QString &packageName) const
+{
+    foreach (const FakeMetaObject::Export &exp, _metaObject->exports())
+        if (exp.package == packageName)
+            return exp.type;
+    return QString();
+}
+
 QmlJS::ComponentVersion QmlObjectValue::version() const
 { return _componentVersion; }
 
@@ -2190,7 +2202,8 @@ QList<QmlObjectValue *> CppQmlTypes::typesForImport(const QString &packageName,
     return objectValuesByName.values();
 }
 
-QmlObjectValue *CppQmlTypes::typeForImport(const QString &qualifiedName) const
+QmlObjectValue *CppQmlTypes::typeForImport(const QString &qualifiedName,
+                                           QmlJS::ComponentVersion version) const
 {
     QString name = qualifiedName;
     QString packageName;
@@ -2205,6 +2218,8 @@ QmlObjectValue *CppQmlTypes::typeForImport(const QString &qualifiedName) const
         const QString typeName = qmlObjectValue->className();
         if (typeName != name)
             continue;
+        if (version.isValid() && version < qmlObjectValue->version())
+            continue;
 
         if (previousCandidate) {
             // check if our new candidate is newer than the one we found previously
diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h
index 76f0a97522897f180de83c2d8f4bdd12d4e2b569..cb273f5f8347a8659ea16c07a5384a331db32d39 100644
--- a/src/libs/qmljs/qmljsinterpreter.h
+++ b/src/libs/qmljs/qmljsinterpreter.h
@@ -420,6 +420,7 @@ public:
     const Value *propertyValue(const FakeMetaProperty &prop) const;
 
     QString packageName() const;
+    QString nameInPackage(const QString &packageName) const;
     ComponentVersion version() const;
     QString defaultPropertyName() const;
     QString propertyType(const QString &propertyName) const;
@@ -563,7 +564,8 @@ public:
     void load(Interpreter::Engine *interpreter, const QList<const FakeMetaObject *> &objects);
 
     QList<Interpreter::QmlObjectValue *> typesForImport(const QString &prefix, ComponentVersion version) const;
-    Interpreter::QmlObjectValue *typeForImport(const QString &qualifiedName) const;
+    Interpreter::QmlObjectValue *typeForImport(const QString &qualifiedName,
+                                               ComponentVersion version = ComponentVersion()) const;
 
     bool hasPackage(const QString &package) const;