summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/qdocdatabase.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2014-03-19 15:12:07 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-31 21:05:23 +0200
commit2ea15849a09208ac19d189acdc51c313b64a0b3a (patch)
tree630825cea808fcd38e39a257754b8dffd72307a5 /src/tools/qdoc/qdocdatabase.cpp
parent900c150a07f627c20ad68ec59253196d9960b034 (diff)
qdoc: \l{Qt::Window} links to the wrong page
kThis update fixes a bug introduced by the extensive changes for QTBUG-35377. The name Qt represents two namespaces, one in C++ and one in QML. The name "Window" is used in both of them, so the link \l{Qt::Window} would cause a collision in the single tree qdoc. In the multiple tree qdoc, there is no collision, but in this case the link should have gone to the C++ page and it went to the QML page instead. The fix involved correcting the way qdoc searches for link targets. Task-number: QTBUG-37633 Change-Id: Ib9b209eced937a0be0d3299f300ebf22b2776012 Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/qdocdatabase.cpp')
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp53
1 files changed, 23 insertions, 30 deletions
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index 289e57d16c..ffd2dd9b3b 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
static NodeMap emptyNodeMap_;
static NodeMultiMap emptyNodeMultiMap_;
+bool QDocDatabase::debug = false;
/*! \class QDocForest
This class manages a collection of trees. Each tree is an
@@ -368,38 +369,30 @@ void QDocForest::newPrimaryTree(const QString& module)
}
/*!
- Searches the Tree \a t for a node named \a target and returns
+ Searches the trees for a node named \a target and returns
a pointer to it if found. The \a relative node is the starting
- point, but it only makes sense in the primary tree. Therefore,
- when this function is called with \a t being an index tree,
- \a relative is 0. When relative is 0, the root node of \a t is
- the starting point.
- */
-const Node* QDocForest::resolveTargetHelper(const QString& target,
- const Node* relative,
- Tree* t)
+ point, but it only makes sense in the primary tree, which is
+ searched first. After the primary tree is searched, \a relative
+ is set to 0 for searching the index trees. When relative is 0,
+ the root node of the index tree is the starting point.
+ */
+const Node* QDocForest::resolveTarget(const QString& target, const Node* relative)
{
- const Node* node = 0;
- if (target.endsWith("()")) {
- QString funcName = target;
- funcName.chop(2);
- QStringList path = funcName.split("::");
- const FunctionNode* fn = t->findFunctionNode(path, relative, SearchBaseClasses);
- if (fn && fn->metaness() != FunctionNode::MacroWithoutParams)
- node = fn;
- }
- else {
- QStringList path = target.split("::");
- int flags = SearchBaseClasses | SearchEnumValues | NonFunction;
- node = t->findNode(path, relative, flags);
- if (!node) {
- QStringList path = target.split("::");
- const FunctionNode* fn = t->findFunctionNode(path, relative, SearchBaseClasses);
- if (fn && fn->metaness() != FunctionNode::MacroWithoutParams)
- node = fn;
- }
+ QStringList path = target.split("::");
+ int flags = SearchBaseClasses | SearchEnumValues | NonFunction;
+
+ foreach (Tree* t, searchOrder()) {
+ const Node* n = t->findNode(path, relative, flags);
+ if (n)
+ return n;
+#if 0
+ n = t->findDocNodeByTitle(target);
+ if (n)
+ return n;
+#endif
+ relative = 0;
}
- return node;
+ return 0;
}
/*!
@@ -1356,7 +1349,7 @@ const Node* QDocDatabase::findNodeForTarget(const QString& target, const Node* r
else {
node = resolveTarget(target, relative);
if (!node)
- node = findDocNodeByTitle(target, relative);
+ node = findDocNodeByTitle(target);
}
return node;
}