diff options
author | Topi Reinio <topi.reinio@qt.io> | 2022-12-07 22:17:08 +0000 |
---|---|---|
committer | Topi Reiniƶ <topi.reinio@qt.io> | 2022-12-12 08:11:09 +0000 |
commit | f003dd86a9b7a6edea2d0266ba8284871c480dd8 (patch) | |
tree | 2fea7debf84b04966c753da1aaa53a456947d6b5 /tests | |
parent | f443f635e942fab8770a8eff6884bc60accb7e1d (diff) | |
download | qttools-f003dd86a9b7a6edea2d0266ba8284871c480dd8.tar.gz |
qdoc: Unify handling of QML types and QML value types
QML value types, formerly known as basic types, are nowadays provided
by multiple modules and contain also properties and methods.
QDoc's support for value types was rather basic (pun intended):
No import/since statements nor sections for properties etc. was
generated, the reference page had essentially a flat structure
similar to a generic \page.
As QML and QML value types are closely related, eliminate the dedicated
Node subclass for value types (QmlValueTypeNode), handle both with
QmlTypeNode class, differentiating them only with NodeType enumeration.
Make Node::isQmlType() return true for both to provide similar behavior
for all QML types, with a few exceptions:
* Do not warn if \qmlvaluetype command is missing \inqmlmodule
info as many of the original value types do not document it
* Do not generate 'all members' file for value types as they're
not expected to inherit other types.
* Do not include the QML module name qualifier into the filenames
generated for value types. This is done in order to keep the
existing behavior for value types and to avoid creating
redirects for online documentation.
Related to the last point, remove code from
Generator::fullDocumentLocation() that was never executed as it was
a duplicate from Generator::fileBase().
Unifying the types under a single Node subclass allows for removal of
multiple functions and code paths related to value types. They have
some constraints compared to proper QML types, but QDoc does not
currently enforce them.
[ChangeLog][QDoc][QDoc now properly outputs documentation for QML
value types with properties and methods.]
Pick-to: 6.4
Fixes: QTBUG-109132
Change-Id: I418660b0a6e0461c82fd5cb67e4f955a0d9a712c
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'tests')
8 files changed, 30 insertions, 14 deletions
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qdoc-test-qmlmodule.xml b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qdoc-test-qmlmodule.xml index 340a83f53..cbdeb19b1 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qdoc-test-qmlmodule.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qdoc-test-qmlmodule.xml @@ -35,7 +35,7 @@ <db:varlistentry> <db:term><db:link xlink:href="qml-int.xml" xlink:role="">int</db:link></db:term> <db:listitem> -<db:para>An integer basic type.</db:para> +<db:para>An integer value type.</db:para> </db:listitem> </db:varlistentry> <db:varlistentry> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-int.xml b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-int.xml index 00ef9ec39..c7ce09e55 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-int.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-int.xml @@ -1,13 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> <db:article xmlns:db="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.2" xml:lang="en"> <db:info> -<db:title>int QML Basic Type</db:title> +<db:title>int QML Value Type</db:title> <db:productname>Test</db:productname> <db:titleabbrev>A test project for QDoc build artifacts</db:titleabbrev> <db:abstract> -<db:para>An integer basic type.</db:para> +<db:para>An integer value type.</db:para> +<db:para>This type was introduced in Qt 1.1.</db:para> </db:abstract> </db:info> +<db:variablelist> +<db:varlistentry> +<db:term>Import Statement</db:term> +<db:listitem> +<db:para>import QDoc.Test 1.1</db:para> +</db:listitem> +</db:varlistentry> +<db:varlistentry> +<db:term>Since:</db:term> +<db:listitem> +<db:para>Qt 1.1</db:para> +</db:listitem> +</db:varlistentry> +</db:variablelist> <db:section xml:id="details"> <db:title>Detailed Description</db:title> </db:section> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/includefromexampledirs/index.html b/tests/auto/qdoc/generatedoutput/expected_output/includefromexampledirs/index.html index 027d13955..f6a73d1dc 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/includefromexampledirs/index.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/includefromexampledirs/index.html @@ -18,7 +18,7 @@ <div class="table"><table class="annotated"> <tr class="odd topAlign"><td class="tblName" translate="no"><p><a href="qml-qdoc-test-abstractparent.html">AbstractParent</a></p></td><td class="tblDescr"><p>Abstract base QML type</p></td></tr> <tr class="even topAlign"><td class="tblName" translate="no"><p><a href="qml-qdoc-test-child.html">Child</a></p></td><td class="tblDescr"><p>A Child inheriting its parent</p></td></tr> -<tr class="odd topAlign"><td class="tblName" translate="no"><p><a href="qml-int.html">int</a></p></td><td class="tblDescr"><p>An integer basic type</p></td></tr> +<tr class="odd topAlign"><td class="tblName" translate="no"><p><a href="qml-int.html">int</a></p></td><td class="tblDescr"><p>An integer value type</p></td></tr> </table></div> <p>Test include file that is part of the sourcedirs.</p> </div> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/qdoc-test-qmlmodule.html b/tests/auto/qdoc/generatedoutput/expected_output/qdoc-test-qmlmodule.html index 121d24018..a603ae147 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/qdoc-test-qmlmodule.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/qdoc-test-qmlmodule.html @@ -20,7 +20,7 @@ <tr class="odd topAlign"><td class="tblName" translate="no"><p><a href="qml-qdoc-test-doctest.html">DocTest</a></p></td><td class="tblDescr"><p>Represents a doc test case</p></td></tr> <tr class="even topAlign"><td class="tblName" translate="no"><p><a href="qml-qdoc-test-type.html">Type</a></p></td><td class="tblDescr"><p>A QML type documented in a .cpp file</p></td></tr> <tr class="odd topAlign"><td class="tblName" translate="no"><p><a href="qml-qdoc-test-yetanotherchild.html">YetAnotherChild</a></p></td><td class="tblDescr"><p>A type inheriting from internal abstract parent</p></td></tr> -<tr class="even topAlign"><td class="tblName" translate="no"><p><a href="qml-int.html">int</a></p></td><td class="tblDescr"><p>An integer basic type</p></td></tr> +<tr class="even topAlign"><td class="tblName" translate="no"><p><a href="qml-int.html">int</a></p></td><td class="tblDescr"><p>An integer value type</p></td></tr> </table></div> </body> </html> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/qml-int.html b/tests/auto/qdoc/generatedoutput/expected_output/qml-int.html index 53b91bc8b..8843b9474 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/qml-int.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/qml-int.html @@ -3,7 +3,7 @@ <head> <meta charset="utf-8"> <!-- parent.qdoc --> - <title>int QML Basic Type | Test</title> + <title>int QML Value Type | Test</title> </head> <body> <li><a href="qdoc-test-qmlmodule.html" translate="no">Types</a></li> @@ -17,17 +17,17 @@ </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> -<h1 class="title" translate="no">int QML Basic Type</h1> +<h1 class="title" translate="no">int QML Value Type</h1> <!-- $$$int-brief --> -<p>An integer basic type. <a href="#details">More...</a></p> +<p>An integer value type. <a href="#details">More...</a></p> <!-- @@@int --> -<h2 id="methods">Methods</h2> +<div class="table"><table class="alignedsummary" translate="no"> +<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QDoc.Test 1.1</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 1.1</td></tr></table></div><h2 id="methods">Methods</h2> <ul> <li class="fn" translate="no">int <b><a href="qml-int.html#abs-method" translate="no">abs</a></b>()</li> </ul> <!-- $$$int-description --> -<div class="descr" id="details"> -</div> +<h2 id="details">Detailed Description</h2> <!-- @@@int --> <h2>Method Documentation</h2> <!-- $$$abs[overload1]$$$abs --> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/test.qhp b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp index 484e167ce..417f5a7fb 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/test.qhp +++ b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp @@ -49,6 +49,7 @@ <section ref="qml-qdoc-test-yetanotherchild.html" title="YetAnotherChild Type Reference"> <section ref="qml-qdoc-test-yetanotherchild-members.html" title="List of all members"/> </section> + <section ref="qml-int.html" title="int Type Reference"/> <section ref="qml-uicomponents-progressbar.html" title="ProgressBar Type Reference"> <section ref="qml-uicomponents-progressbar-members.html" title="List of all members"/> </section> @@ -58,7 +59,6 @@ <section ref="qml-uicomponents-tabwidget.html" title="TabWidget Type Reference"> <section ref="qml-uicomponents-tabwidget-members.html" title="List of all members"/> </section> - <section ref="qml-int.html" title="int Type Reference"/> </section> </section> </toc> @@ -127,6 +127,7 @@ <keyword name="id" id="Type::id" ref="qml-qdoc-test-type.html#id-prop"/> <keyword name="inlineFunction" id="Test::inlineFunction" ref="testqdoc-test.html#inlineFunction"/> <keyword name="int" id="QML.int" ref="qml-int.html"/> + <keyword name="int" id="QML.QDoc.Test1.int" ref="qml-int.html"/> <keyword name="itsHappening" id="DocTest::itsHappening" ref="qml-qdoc-test-doctest.html#itsHappening-signal"/> <keyword name="maximum" id="ProgressBar::maximum" ref="qml-uicomponents-progressbar.html#maximum-prop"/> <keyword name="methodWithEmDashInItsDocs" id="Test::methodWithEmDashInItsDocs" ref="testqdoc-test.html#methodWithEmDashInItsDocs"/> diff --git a/tests/auto/qdoc/generatedoutput/testdata/includefromexampledirs/src/includefromparent.qdoc b/tests/auto/qdoc/generatedoutput/testdata/includefromexampledirs/src/includefromparent.qdoc index bcf2788d5..ee3ccbe25 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/includefromexampledirs/src/includefromparent.qdoc +++ b/tests/auto/qdoc/generatedoutput/testdata/includefromexampledirs/src/includefromparent.qdoc @@ -37,5 +37,5 @@ \qmlvaluetype int \inqmlmodule QDoc.Test \ingroup qmltypes - \brief An integer basic type. + \brief An integer value type. */ diff --git a/tests/auto/qdoc/generatedoutput/testdata/qml/parent.qdoc b/tests/auto/qdoc/generatedoutput/testdata/qml/parent.qdoc index db7ea37d8..d6bbb5738 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/qml/parent.qdoc +++ b/tests/auto/qdoc/generatedoutput/testdata/qml/parent.qdoc @@ -58,7 +58,7 @@ \qmlvaluetype int \inqmlmodule QDoc.Test - \brief An integer basic type. + \brief An integer value type. */ /*! |