diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index a120e45..67de69c 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -96,6 +96,7 @@ QT_BEGIN_NAMESPACE
 #define COMMAND_QMLATTACHEDMETHOD       Doc::alias("qmlattachedmethod")
 #define COMMAND_QMLDEFAULT              Doc::alias("default")
 #define COMMAND_QMLBASICTYPE            Doc::alias("qmlbasictype")
+#define COMMAND_QMLMODULE               Doc::alias("qmlmodule")
 #endif
 
 QStringList CppCodeParser::exampleFiles;
@@ -909,7 +910,8 @@ QSet<QString> CppCodeParser::otherMetaCommands()
 #ifdef QDOC_QML
                                 << COMMAND_STARTPAGE
                                 << COMMAND_QMLINHERITS
-                                << COMMAND_QMLDEFAULT;
+                                << COMMAND_QMLDEFAULT
+                                << COMMAND_QMLMODULE;
 #else
                                 << COMMAND_STARTPAGE;
 #endif
@@ -1031,6 +1033,11 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc,
             QmlClassNode::addInheritedBy(arg,node);
         }
    }
+   else if (command == COMMAND_QMLMODULE) {
+        if (node->subType() == Node::QmlClass) {
+            static_cast<QmlClassNode*>(node)->setQmlModuleName(arg);
+        }
+   }
     else if (command == COMMAND_QMLDEFAULT) {
         QmlPropGroupNode* qpgn = static_cast<QmlPropGroupNode*>(node);
         qpgn->setDefault();
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 41f90d5..1ed64d2 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -1550,6 +1550,9 @@ QString QmlClassNode::fileBase() const
         qDebug() << "FILEBASE: qmlitem" << name();
     return "qml_" + Node::fileBase();
 #endif
+    if (!qmlModule.isEmpty()) {
+        return qmlModule.toLower() + "-" + Node::fileBase();
+    }
     return Node::fileBase();
 }
 
@@ -1566,6 +1569,14 @@ void QmlClassNode::addInheritedBy(const QString& base, Node* sub)
 }
 
 /*!
+  Specify the QML module name \a module which this qmlclass comes from.
+ */
+void QmlClassNode::setQmlModuleName(const QString& module)
+{
+    qmlModule = module;
+}
+
+/*!
   Loads the list \a subs with the nodes of all the subclasses of \a base.
  */
 void QmlClassNode::subclasses(const QString& base, NodeList& subs)
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index 40b78ef..8208356 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -402,6 +402,9 @@ class QmlClassNode : public FakeNode
 
     const ClassNode* classNode() const { return cnode; }
     virtual QString fileBase() const;
+    QString qmlModuleName() const { return qmlModule;}
+    void setQmlModuleName(const QString& module);
+
     static void addInheritedBy(const QString& base, Node* sub);
     static void subclasses(const QString& base, NodeList& subs);
     static void clear();
@@ -412,6 +415,7 @@ class QmlClassNode : public FakeNode
 
  private:
     const ClassNode*    cnode;
+    QString qmlModule;
 };
 
 class QmlBasicTypeNode : public FakeNode
diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp
index 37dc191..807daba 100644
--- a/tools/qdoc3/pagegenerator.cpp
+++ b/tools/qdoc3/pagegenerator.cpp
@@ -209,6 +209,11 @@ QString PageGenerator::fileBase(const Node *node) const
          */
         if ((p->subType() == Node::QmlClass) ||
             (p->subType() == Node::QmlBasicType)) {
+            if ((p->subType() == Node::QmlClass)) {
+                QString mod = static_cast<const QmlClassNode*>(p)->qmlModuleName();
+                if (!mod.isEmpty())
+                    base.prepend(mod + "-");
+            }
             if (!base.startsWith(QLatin1String("QML:")))
                 base.prepend("qml-");
         }
diff --git a/tools/qdoc3/qscodeparser.cpp b/tools/qdoc3/qscodeparser.cpp
index 3b8bc1a..85b2044 100644
--- a/tools/qdoc3/qscodeparser.cpp
+++ b/tools/qdoc3/qscodeparser.cpp
@@ -294,6 +294,7 @@ Node *QsCodeParser::processTopicCommand(const Doc& doc,
 	if (subArgs.count() == 3 && subArgs[1] == ":") {
 	    dataType = subArgs[2];
 	}
+
         else if (subArgs.count() != 1) {
 	    doc.location().warning(tr("Invalid syntax in '\\%1'")
 				    .arg(command));
diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp
index 540ffa9..8ee744e 100644
--- a/tools/qdoc3/tree.cpp
+++ b/tools/qdoc3/tree.cpp
@@ -1965,8 +1965,9 @@ QString Tree::fullDocumentLocation(const Node *node) const
             QString fb = node->fileBase();
             if (fb.startsWith(QLatin1String("qml-")))
                 return fb + ".html";
-            else
+            else {
                 return "qml-" + node->fileBase() + ".html";
+            }
         } else
 #endif
         parentName = node->fileBase() + ".html";
