summaryrefslogtreecommitdiff
path: root/src/qdoc/tree.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2021-03-11 13:32:13 +0100
committerTopi Reinio <topi.reinio@qt.io>2021-03-22 10:18:32 +0100
commit10268e3e9c5f47db8231f2ac907a46cf9283d365 (patch)
treeccfa72e90a0bf30dbfcfa1f0ba835afad49be4dc /src/qdoc/tree.cpp
parentccd9f4eb9b8200fa26f32ffacae6ae93619ca867 (diff)
downloadqttools-10268e3e9c5f47db8231f2ac907a46cf9283d365.tar.gz
qdoc: Stop auto-linking to section titles
The purpose of the auto-linking feature is to link strings in the text that resemble class or function names to API reference. However, QDoc did not discriminate between the types of the resolved link targets. Therefore, writing \section1 QString on a random \page would potentially redirect all autolinks to QString to that section. To fix, turn Node::Genus into attributes so we can do bitwise operations on the genus, and introduce Node::API that includes all API reference node genera. Node::API is not assigned to nodes directly, but is used in searches to match against any API reference nodes. Pick-to: 6.0 6.1 Task-number: QTBUG-91141 Change-Id: Ic0a22b7105e1278662f5ae7d4132980200638225 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/tree.cpp')
-rw-r--r--src/qdoc/tree.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qdoc/tree.cpp b/src/qdoc/tree.cpp
index 138798d20..9d220d9d7 100644
--- a/src/qdoc/tree.cpp
+++ b/src/qdoc/tree.cpp
@@ -595,7 +595,7 @@ const Node *Tree::matchPathAndTarget(const QStringList &path, int idx, const QSt
NodeVector nodes;
static_cast<const Aggregate *>(node)->findChildren(name, nodes);
for (const auto *node : qAsConst(nodes)) {
- if (genus != Node::DontCare && node->genus() != genus)
+ if (genus != Node::DontCare && !(genus & node->genus()))
continue;
const Node *t = matchPathAndTarget(path, idx + 1, target, node, flags, genus, ref);
if (t && !t->isPrivate())
@@ -830,7 +830,7 @@ const Node *Tree::findUnambiguousTarget(const QString &target, Node::Genus genus
if (it.key() != key)
break;
TargetRec *candidate = it.value();
- if ((genus == Node::DontCare) || (genus == candidate->genus())) {
+ if ((genus == Node::DontCare) || (genus & candidate->genus())) {
if (!bestTarget || (candidate->priority_ < bestTarget->priority_)) {
bestTarget = candidate;
bestTargetList.clear();
@@ -854,7 +854,7 @@ const Node *Tree::findUnambiguousTarget(const QString &target, Node::Genus genus
if (it.key() != key)
break;
TargetRec *candidate = it.value();
- if ((genus == Node::DontCare) || (genus == candidate->genus())) {
+ if ((genus == Node::DontCare) || (genus & candidate->genus())) {
if (!bestTarget || (candidate->priority_ < bestTarget->priority_)) {
bestTarget = candidate;
bestTargetList.clear();
@@ -1216,7 +1216,7 @@ const FunctionNode *Tree::findFunctionNode(const QStringList &path, const Parame
if (relative == nullptr)
relative = root();
else if (genus != Node::DontCare) {
- if (genus != relative->genus())
+ if (!(genus & relative->genus()))
relative = root();
}