summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2019-09-18 14:37:13 +0200
committerTopi Reinio <topi.reinio@qt.io>2019-09-20 12:02:13 +0200
commit4d41739403202c6717f9c2a1a9321d2ef76caeee (patch)
treef80f64c7e6c03a2a1364e2082b0517524150785f
parent5cfa917baf416f6234bd99e51f05514b1859e2fe (diff)
downloadqttools-4d41739403202c6717f9c2a1a9321d2ef76caeee.tar.gz
qdoc: Fix issues with related non-members
The \relates command sets a node as a related non-member of another node, and sets that node as the new parent. However, the old parent still holds a pointer to the newly-adopted node; this is needed for searching. Some locations in the code did not handle the possibility of parent's children reporting a different node as their parent. Skipping these nodes when traversing the node tree eliminates duplicate entries from .qhp files. These duplicates are however needed in the .index files for linking to work, as links may reference both the global namespace and the scope the node relates to. Remove these duplicates from .qhp files, and omit parent names when generating 'id' attributes for related non-members. This reverts the .qhp content to what it was in Qt 5.12. Parents of related members must be skipped when resolving the full name of the node, otherwise searching for the name is likely to fail. Non-members related to a header file did not receive a valid location ('href'). Task-number: QTBUG-78474 Change-Id: Ie126219e8101beaa051f2f4a1a9f93c731fc8168 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Martin Smith <martin.smith@qt.io>
-rw-r--r--src/qdoc/generator.cpp1
-rw-r--r--src/qdoc/helpprojectwriter.cpp8
-rw-r--r--src/qdoc/node.cpp8
3 files changed, 12 insertions, 5 deletions
diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp
index c7831d1fd..de9976502 100644
--- a/src/qdoc/generator.cpp
+++ b/src/qdoc/generator.cpp
@@ -677,6 +677,7 @@ QString Generator::fullDocumentLocation(const Node *node, bool useSubdir)
case Node::QmlType:
case Node::Page:
case Node::Group:
+ case Node::HeaderFile:
case Node::Module:
case Node::JsModule:
case Node::QmlModule:
diff --git a/src/qdoc/helpprojectwriter.cpp b/src/qdoc/helpprojectwriter.cpp
index 500052eb6..226ca4154 100644
--- a/src/qdoc/helpprojectwriter.cpp
+++ b/src/qdoc/helpprojectwriter.cpp
@@ -216,7 +216,10 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const
else
details << node->name();
// "id"
- details << node->parent()->name()+"::"+node->name();
+ if (!node->isRelatedNonmember())
+ details << node->parent()->name()+"::"+node->name();
+ else
+ details << node->name();
}
else if (node->isQmlType() || node->isQmlBasicType()) {
details << node->name();
@@ -491,6 +494,9 @@ void HelpProjectWriter::generateSections(HelpProject &project, QXmlStreamWriter
QSet<const Node*> childSet;
const NodeList &children = aggregate->childNodes();
foreach (const Node *child, children) {
+ // Skip related non-members adopted by some other aggregate
+ if (child->parent() != aggregate)
+ continue;
if (child->isIndexNode() || child->isPrivate())
continue;
if (child->isTextPageNode()) {
diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp
index 774d41f31..82bcd1b25 100644
--- a/src/qdoc/node.cpp
+++ b/src/qdoc/node.cpp
@@ -3101,11 +3101,11 @@ QString Node::fullDocumentName() const
if (n->isTextPageNode())
break;
- // Examine the parent node if one exists.
- if (n->parent())
- n = n->parent();
- else
+ // Examine the parent if the node is a member
+ if (!n->parent() || n->isRelatedNonmember())
break;
+
+ n = n->parent();
} while (true);
// Create a name based on the type of the ancestor node.