From 1e39c712bd726e9ef426ecc316edad58d134decf Mon Sep 17 00:00:00 2001
From: Topi Reinio <topi.reinio@digia.com>
Date: Mon, 3 Aug 2015 13:32:06 +0200
Subject: [PATCH] qdoc: Do not merge QML module nodes with different major
 versions

As we may have multiple versions of a QML module present in the
doc build, the logic QDoc uses for merging collection nodes from
different trees needs to be revised a bit.

After this change, the collection nodes for identically-named
QML and JS modules are merged only if the major version number
matches. This prevents the situation where QML types for both
versions are listed in QML module pages.

Change-Id: I76b056a2073744347b160b25ed5bb043279f2b8a
Task-number: QTBUG-47536
Reviewed-by: Martin Smith <martin.smith@digia.com>
---
 src/tools/qdoc/qdocdatabase.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index b0f1758a849..5f2a61bb765 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -1579,6 +1579,13 @@ void QDocDatabase::mergeCollections(Node::Genus genus, CNMap& cnm, const Node* r
             if (values.size() > 1) {
                 foreach (CollectionNode* v, values) {
                     if (v != n) {
+                        // Allow multiple (major) versions of QML/JS modules
+                        if (n->type() == Node::QmlModule
+                                && n->logicalModuleIdentifier() != v->logicalModuleIdentifier()) {
+                            if (v->wasSeen() && v != relative && !v->members().isEmpty())
+                                cnm.insert(v->fullTitle().toLower(), v);
+                            continue;
+                        }
                         foreach (Node* t, v->members())
                             n->addMember(t);
                     }
@@ -1599,12 +1606,19 @@ void QDocDatabase::mergeCollections(Node::Genus genus, CNMap& cnm, const Node* r
   Finds all the collection nodes with the same name
   and genus as \a c and merges their members into the
   members list of \a c.
+
+  For QML and JS modules, the merge is done only if
+  the module identifier matches between the nodes, to avoid
+  merging modules with different (major) versions.
  */
 void QDocDatabase::mergeCollections(CollectionNode* c)
 {
     foreach (Tree* t, searchOrder()) {
         CollectionNode* cn = t->getCollection(c->name(), c->genus());
         if (cn && cn != c) {
+            if (cn->type() == Node::QmlModule
+                    && cn->logicalModuleIdentifier() != c->logicalModuleIdentifier())
+                continue;
             foreach (Node* n, cn->members())
                 c->addMember(n);
         }
-- 
GitLab