diff options
author | Topi Reinio <topi.reinio@qt.io> | 2023-03-17 10:18:57 +0000 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2023-03-22 13:10:27 +0000 |
commit | 757c3d8dd9e6528926e8765d91ede29b8523e466 (patch) | |
tree | 7a3bc712d8e795bf52df76a372bc61ad9fc879bf | |
parent | 1d17e5edf2a81a9bcea946fa03ccfe90abf37c8b (diff) | |
download | qttools-757c3d8dd9e6528926e8765d91ede29b8523e466.tar.gz |
qdoc: Exclude broken links to \dontdocument nodes in \sincelist output
Streamline Aggregate::findAllSince() and stop it from generating items
marked with \dontdocument command; these resulted in broken links if a
dont-document class uses a \since command.
Change-Id: I1d06e3c846c206cdc54edb9e1fe9b1b8b105b544
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
-rw-r--r-- | src/qdoc/aggregate.cpp | 32 | ||||
-rw-r--r-- | tests/auto/qdoc/generatedoutput/expected_output/scopedenum/whatsnew.html | 5 |
2 files changed, 14 insertions, 23 deletions
diff --git a/src/qdoc/aggregate.cpp b/src/qdoc/aggregate.cpp index 9931d9d4f..171e92a17 100644 --- a/src/qdoc/aggregate.cpp +++ b/src/qdoc/aggregate.cpp @@ -744,41 +744,35 @@ void Aggregate::findAllSince() continue; QString sinceString = node->since(); // Insert a new entry into each map for each new since string found. - if (!node->isPrivate() && !sinceString.isEmpty()) { - auto nsmap = QDocDatabase::newSinceMaps().find(sinceString); - if (nsmap == QDocDatabase::newSinceMaps().end()) - nsmap = QDocDatabase::newSinceMaps().insert(sinceString, {}); - - auto ncmap = QDocDatabase::newClassMaps().find(sinceString); - if (ncmap == QDocDatabase::newClassMaps().end()) - ncmap = QDocDatabase::newClassMaps().insert(sinceString, {}); - - auto nqcmap = QDocDatabase::newQmlTypeMaps().find(sinceString); - if (nqcmap == QDocDatabase::newQmlTypeMaps().end()) - nqcmap = QDocDatabase::newQmlTypeMaps().insert(sinceString, {}); + if (node->isInAPI() && !sinceString.isEmpty()) { + // operator[] will insert a default-constructed value into the + // map if key is not found, which is what we want here. + auto &nsmap = QDocDatabase::newSinceMaps()[sinceString]; + auto &ncmap = QDocDatabase::newClassMaps()[sinceString]; + auto &nqcmap = QDocDatabase::newQmlTypeMaps()[sinceString]; if (node->isFunction()) { // Insert functions into the general since map. auto *fn = static_cast<FunctionNode *>(node); if (!fn->isDeprecated() && !fn->isSomeCtor() && !fn->isDtor()) - nsmap.value().insert(fn->name(), fn); + nsmap.insert(fn->name(), fn); } else if (node->isClassNode()) { // Insert classes into the since and class maps. QString name = node->qualifyWithParentName(); - nsmap.value().insert(name, node); - ncmap.value().insert(name, node); + nsmap.insert(name, node); + ncmap.insert(name, node); } else if (node->isQmlType()) { // Insert QML elements into the since and element maps. QString name = node->qualifyWithParentName(); - nsmap.value().insert(name, node); - nqcmap.value().insert(name, node); + nsmap.insert(name, node); + nqcmap.insert(name, node); } else if (node->isQmlProperty()) { // Insert QML properties into the since map. - nsmap.value().insert(node->name(), node); + nsmap.insert(node->name(), node); } else { // Insert external documents into the general since map. QString name = node->qualifyWithParentName(); - nsmap.value().insert(name, node); + nsmap.insert(name, node); } } // Enum values - a special case as EnumItem is not a Node subclass diff --git a/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/whatsnew.html b/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/whatsnew.html index 6d6989f49..f284b86f6 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/whatsnew.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/scopedenum/whatsnew.html @@ -21,10 +21,7 @@ </table></div> <h3 id="new-classes">New Classes</h3> <div class="flowListDiv" translate="no"> -<dl class="flowList odd"><dt class="alphaChar"><b>D</b></dt> -<dd><a href="">DontLinkToMe</a></dd> -</dl> -<dl class="flowList even"><dt class="alphaChar"><b>T</b></dt> +<dl class="flowList odd"><dt class="alphaChar"><b>T</b></dt> <dd><a href="testqdoc-test.html">Test</a> (<a href="testqdoc.html">TestQDoc</a>)</dd> <dd><a href="testqdoc-testderived.html">TestDerived</a> (<a href="testqdoc.html">TestQDoc</a>)</dd> </dl> |