From 12f8258efcab39a571df4cbb8cacf5bfc2eb8a82 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 28 Oct 2020 21:17:48 +0100 Subject: qdoc: Allow type aliases as a parameter to \class command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ƶ --- .../expected_output/template/testqdoc-vec.html | 35 ++++++++++++++++++++++ .../generatedoutput/testdata/testcpp/testcpp.cpp | 9 ++++++ .../generatedoutput/testdata/testcpp/testcpp.h | 7 +++++ .../qdoc/generatedoutput/tst_generatedoutput.cpp | 1 + 4 files changed, 52 insertions(+) create mode 100644 tests/auto/qdoc/generatedoutput/expected_output/template/testqdoc-vec.html (limited to 'tests') 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 @@ + + + + + + Vec Class | TestCPP + + +
  • Vec
  • + +

    Vec Class

    +template <typename T> class TestQDoc::Vec + +

    Type alias that has its own reference. More...

    + +
    +
    Header: #include <Vec> +
    CMake: find_package(Qt6 COMPONENT QDocTest)
    +target_link_libraries(mytarget PUBLIC Qt::QDocTest)
    qmake: QT += testcpp
    + + +
    +

    Detailed Description

    +
    + + + 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 +struct BaseVec {}; +template +using Vec = BaseVec; +#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"); -- cgit v1.2.3