path: root/src/tools/qdoc/cppcodemarker.cpp
diff options
authorMartin Smith <>2015-03-17 13:50:06 +0100
committerMartin Smith <>2015-03-27 13:55:44 +0000
commit6a5e2f69a898b0fca3ec75caeddac4a69803269f (patch)
tree1286a6ffdc45ed074a3525debe738420e80f1bd1 /src/tools/qdoc/cppcodemarker.cpp
parent58da6f96a84e6e140d384b2e422c0fdf020897ea (diff)
qdoc: Update for classes in namespaces
The resolving of namespaces across module boundaries was moving all the nodes for elements contained in the namespace into the namespace node for the \namespace command for that namespace. But moving class and namespace nodes is wrong because they are actually in different modules where they should also be output. This update to the fix for the original bug leaves the class and nested namespace nodes where they are but adds them as special "orphan" nodes to the namespace node that has the \namespace command. These orphan nodes are then included in the namespace content list when it is written out. Change-Id: I0eee368ed39f28129b5b43bb4a16963961f53db3 Task-number: QTBUG-44688 Reviewed-by: Martin Smith <>
Diffstat (limited to 'src/tools/qdoc/cppcodemarker.cpp')
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp
index 1546b5226e..4c1e84fe3c 100644
--- a/src/tools/qdoc/cppcodemarker.cpp
+++ b/src/tools/qdoc/cppcodemarker.cpp
@@ -807,6 +807,21 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
+ if (inner->isNamespace()) {
+ const NamespaceNode* ns = static_cast<const NamespaceNode*>(inner);
+ if (!ns->orphans().isEmpty()) {
+ foreach (Node* n, ns->orphans()) {
+ // Use inner as a temporary parent when inserting orphans
+ InnerNode* p = n->parent();
+ n->setParent(const_cast<InnerNode*>(inner));
+ if (n->isClass())
+ insert(classes, n, style, status);
+ else if (n->isNamespace())
+ insert(namespaces, n, style, status);
+ n->setParent(p);
+ }
+ }
+ }
append(sections, namespaces);
append(sections, classes);
append(sections, types);