diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-10-28 21:17:48 +0100 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-11-09 23:02:24 +0100 |
commit | 12f8258efcab39a571df4cbb8cacf5bfc2eb8a82 (patch) | |
tree | 70d07f8f1f411d22a791e7f0204bd3c0effbdf6d /tests | |
parent | 071b4615e264cf097414095828e6b8bea742c065 (diff) |
qdoc: Allow type aliases as a parameter to \class command
In Qt 6, some types that used to be classes are now type aliases or
specializations of a templated class; for example, QPair is now an
alias to std::pair.
While the \typedef command supports aliases, it's not always clear
where the reference of such type should live, as a \typedef cannot
generate a page of its own and needs to be related to some other
aggregate (class, header, or namespace). Therefore, allow aliases
to generate a type page using the \class command.
Fixes: QTBUG-88012
Change-Id: Ice67d58eb036299c0fd04f6ed48a846bfed8ed1d
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'tests')
4 files changed, 52 insertions, 0 deletions
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 <typename T> 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 <Vec></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"); |