diff options
author | Topi Reinio <topi.reinio@digia.com> | 2015-07-30 12:51:22 +0200 |
---|---|---|
committer | Topi Reiniƶ <topi.reinio@digia.com> | 2015-08-03 12:37:57 +0000 |
commit | 7b77ef6b0a28886296e8a551339eb2874470bfc2 (patch) | |
tree | aa3198a7a442f9f6ca34ac0e615ec15f3c8c459c /src/tools/qdoc/tree.cpp | |
parent | 789c9954c788b6129b3b406db4d68b5bb52386b8 (diff) |
qdoc: Make \target and \keyword commands link as expected
When resolving targets added for each node, QDoc didn't run the
check recursively; this meant that \target and \keyword commands
did not link when used in documentation nodes that are not direct
children of the root node. There include e.g. documentation for
functions and QML properties/methods.
This commit fixes that issue, and also modifies the behavior of
\keyword slightly: Using a \keyword no longer generates a HTML
anchor reference. Instead, linking to a keyword links directly
to the parent item which defines the \keyword. This produces
cleaner HTML by omitting unnecessary anchors.
Change-Id: I87659642770a5372409ecb09cb576fbad295155e
Task-number: QTBUG-47286
Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/tree.cpp')
-rw-r--r-- | src/tools/qdoc/tree.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp index 6c21d730c1..e0fd68d2e7 100644 --- a/src/tools/qdoc/tree.cpp +++ b/src/tools/qdoc/tree.cpp @@ -995,7 +995,6 @@ void Tree::insertTarget(const QString& name, */ void Tree::resolveTargets(Aggregate* root) { - // need recursion foreach (Node* child, root->childNodes()) { if (child->type() == Node::Document) { DocumentNode* node = static_cast<DocumentNode*>(child); @@ -1039,9 +1038,8 @@ void Tree::resolveTargets(Aggregate* root) QString ref = refForAtom(keywords.at(i)); QString title = keywords.at(i)->string(); if (!ref.isEmpty() && !title.isEmpty()) { - QString key = Doc::canonicalTitle(title); TargetRec* target = new TargetRec(ref, title, TargetRec::Keyword, child, 1); - nodesByTargetRef_.insert(key, target); + nodesByTargetRef_.insert(Doc::canonicalTitle(title), target); nodesByTargetTitle_.insert(title, target); } } @@ -1059,6 +1057,8 @@ void Tree::resolveTargets(Aggregate* root) } } } + if (child->isAggregate()) + resolveTargets(static_cast<Aggregate*>(child)); } } |