summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qdoc/cppcodeparser.cpp14
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-vec.html35
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp9
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h7
-rw-r--r--tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp1
5 files changed, 66 insertions, 0 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index bfc4b6e8d..d49566ba9 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -29,6 +29,7 @@
#include "cppcodeparser.h"
#include "access.h"
+#include "classnode.h"
#include "collectionnode.h"
#include "config.h"
#include "examplenode.h"
@@ -213,6 +214,19 @@ Node *CppCodeParser::processTopicCommand(const Doc &doc, const QString &command,
node = qdb_->findNodeInOpenNamespace(path, m_nodeTypeTestFuncMap[command]);
if (node == nullptr)
node = qdb_->findNodeByNameAndType(path, m_nodeTypeTestFuncMap[command]);
+ // Allow representing a type alias as a class
+ if (node == nullptr && command == COMMAND_CLASS) {
+ node = qdb_->findNodeByNameAndType(path, &Node::isTypeAlias);
+ if (node) {
+ auto access = node->access();
+ auto loc = node->location();
+ auto templateDecl = node->templateDecl();
+ node = new ClassNode(Node::Class, node->parent(), node->name());
+ node->setAccess(access);
+ node->setLocation(loc);
+ node->setTemplateDecl(templateDecl);
+ }
+ }
if (node == nullptr) {
if (isWorthWarningAbout(doc)) {
doc.location().warning(
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-vec.html b/tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-vec.html
new file mode 100644
index 000000000..a186ce24a
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-vec.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+<!-- testcpp.cpp -->
+ <title>Vec Class | TestCPP</title>
+</head>
+<body>
+<li>Vec</li>
+<div class="sidebar">
+<div class="toc">
+<h3><a name="toc">Contents</a></h3>
+<ul>
+<li class="level1"><a href="#details">Detailed Description</a></li>
+</ul>
+</div>
+<div class="sidebar-content" id="sidebar-content"></div></div>
+<h1 class="title">Vec Class</h1>
+<span class="small-subtitle">template &lt;typename T&gt; class <a href="testqdoc.html">TestQDoc</a>::Vec</span>
+<!-- $$$Vec-brief -->
+<p>Type alias that has its own reference. <a href="#details">More...</a></p>
+<!-- @@@Vec -->
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include &lt;Vec&gt;</span>
+</td></tr><tr><td class="memItemLeft rightAlign topAlign"> CMake:</td><td class="memItemRight bottomAlign"> find_package(Qt6 COMPONENT QDocTest) <br/>
+target_link_libraries(mytarget PUBLIC Qt::QDocTest)</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += testcpp</td></tr></table></div><ul>
+</ul>
+<a name="details"></a>
+<!-- $$$Vec-description -->
+<div class="descr">
+<h2 id="details">Detailed Description</h2>
+</div>
+<!-- @@@Vec -->
+</body>
+</html>
diff --git a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp
index 750941aef..af384f35d 100644
--- a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp
+++ b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.cpp
@@ -268,4 +268,13 @@ void TestDerived::virtualFun()
\endif
*/
+/*!
+\if defined(test_template)
+ \class TestQDoc::Vec
+ \inmodule TestCPP
+ \brief Type alias that has its own reference.
+\else
+ \nothing
+\endif
+*/
} // namespace TestQDoc
diff --git a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h
index 8543593d2..bf5ed89de 100644
--- a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h
+++ b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h
@@ -116,4 +116,11 @@ public Q_SLOTS:
#endif
};
+#ifdef test_template
+template <typename T>
+struct BaseVec {};
+template <typename T>
+using Vec = BaseVec<T>;
+#endif
+
} // namespace TestQDoc
diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
index 909a10141..4fa78fd72 100644
--- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
+++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
@@ -363,6 +363,7 @@ void tst_generatedOutput::templateParameters()
testAndCompare("testdata/configs/testtemplate.qdocconf",
"template/testqdoc-test.html "
"template/testqdoc-test-struct.html "
+ "template/testqdoc-vec.html "
"template/foo.html "
"template/bar.html "
"template/baz.html");