diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp
index 8de65a1b5bf529c795ff5e01f05bdfa174565320..b9237424a8769999c4f998e49a60475a7f73b180 100644
--- a/src/libs/qmljs/qmljsinterpreter.cpp
+++ b/src/libs/qmljs/qmljsinterpreter.cpp
@@ -430,7 +430,7 @@ private:
     }
 
     bool split(const QString &name, QString *packageName, QString *className) {
-        int dotIdx = name.indexOf(QLatin1Char('.'));
+        int dotIdx = name.lastIndexOf(QLatin1Char('.'));
         if (dotIdx != -1) {
             if (packageName)
                 *packageName = name.left(dotIdx);
diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp
index 24c4b0bc759ed2fa07714e4a88c6024ec2629eec..5b597f2b622410bbad1aece809171ca43621b2a3 100644
--- a/src/libs/qmljs/qmljslink.cpp
+++ b/src/libs/qmljs/qmljslink.cpp
@@ -275,7 +275,7 @@ void Link::importNonFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc, A
         namespaceObject = typeEnv;
     }
 
-    const QString package = Bind::toString(import->importUri, '/');
+    const QString packageName = Bind::toString(import->importUri, '.');
     int majorVersion = QmlObjectValue::NoVersion;
     int minorVersion = QmlObjectValue::NoVersion;
 
@@ -300,18 +300,19 @@ void Link::importNonFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc, A
     }
 
     // if the package is in the meta type system, use it
-    if (engine()->metaTypeSystem().hasPackage(package)) {
-        foreach (QmlObjectValue *object, engine()->metaTypeSystem().staticTypesForImport(package, majorVersion, minorVersion)) {
+    if (engine()->metaTypeSystem().hasPackage(packageName)) {
+        foreach (QmlObjectValue *object, engine()->metaTypeSystem().staticTypesForImport(packageName, majorVersion, minorVersion)) {
             namespaceObject->setProperty(object->className(), object);
         }
         return;
     } else {
         // check the filesystem
+        const QString packagePath = Bind::toString(import->importUri, QDir::separator());
         QStringList localImportPaths = _importPaths;
         localImportPaths.prepend(doc->path());
         foreach (const QString &importPath, localImportPaths) {
             QDir dir(importPath);
-            if (!dir.cd(package))
+            if (!dir.cd(packagePath))
                 continue;
 
             const LibraryInfo libraryInfo = _snapshot.libraryInfo(dir.path());