From 72e5fda3bd1b50ee3e0da0b5ef6505e632f7f5bc Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 25 Aug 2015 16:00:01 +0200 Subject: qdoc: Correctly resolve non-function links that end in parentheses If QDoc fails to find a function node for a link target that ends in parentheses, it must retry to find another type of node, as page/section titles can sometimes resemble function signatures. This fixes a regression introduced by commit 8c5ce68f. Change-Id: I675fe5b93ecc8a1823c0a5f817fb4b80b4e63320 Task-number: QTBUG-47919 Reviewed-by: Alex Blasche Reviewed-by: Martin Smith --- src/tools/qdoc/qdocdatabase.cpp | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'src/tools/qdoc') diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 5ca8e36ef9..6312deacbf 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -306,15 +306,12 @@ const Node* QDocForest::findNodeForTarget(QStringList& targetPath, { int flags = SearchBaseClasses | SearchEnumValues; - QString entity = targetPath.at(0); - targetPath.removeFirst(); + QString entity = targetPath.takeFirst(); QStringList entityPath = entity.split("::"); QString target; - if (!targetPath.isEmpty()) { - target = targetPath.at(0); - targetPath.removeFirst(); - } + if (!targetPath.isEmpty()) + target = targetPath.takeFirst(); foreach (Tree* t, searchOrder()) { const Node* n = t->findNodeForTarget(entityPath, target, relative, flags, genus, ref); @@ -1703,37 +1700,28 @@ const Node* QDocDatabase::findNodeForAtom(const Atom* a, const Node* relative, Q function = first.left(position); node = domain->findFunctionNode(function, params, 0, genus); } - else { + if (!node) { int flags = SearchBaseClasses | SearchEnumValues; QStringList nodePath = first.split("::"); QString target; targetPath.removeFirst(); - if (!targetPath.isEmpty()) { - target = targetPath.at(0); - targetPath.removeFirst(); - } + if (!targetPath.isEmpty()) + target = targetPath.takeFirst(); if (relative && relative->tree()->physicalModuleName() != domain->physicalModuleName()) relative = 0; - node = domain->findNodeForTarget(nodePath, target, relative, flags, genus, ref); - return node; + return domain->findNodeForTarget(nodePath, target, relative, flags, genus, ref); } } else { - if (first.endsWith(".html")) { + if (first.endsWith(".html")) node = findNodeByNameAndType(QStringList(first), Node::Document); - // the path may also refer to an example file with .html extension - if (!node && first.contains("/")) - return findNodeForTarget(targetPath, relative, genus, ref); - } else if (first.endsWith(QChar(')'))) { node = findFunctionNode(first, relative, genus); if (Generator::debugging()) qDebug() << " node:" << node; } - else { - node = findNodeForTarget(targetPath, relative, genus, ref); - return node; - } + if (!node) + return findNodeForTarget(targetPath, relative, genus, ref); } if (node && ref.isEmpty()) { -- cgit v1.2.3