diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-07-15 14:15:25 +0200 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-07-15 20:35:27 +0200 |
commit | f68e83d7634c929bef57fc534861768bb9785c74 (patch) | |
tree | c91ab0a68744b29461778c49bda059e310069e7b /tests | |
parent | 87fdeb7f99e08c5f670298fafa7e5a19ce8e71b8 (diff) |
qdoc: Introduce \required command and handle REQUIRED for QML properties
Q_PROPERTY macro now supports the REQUIRED keyword. This is relevant for
QML types, where the type cannot be instatiated without declaring all
required properties.
Make QDoc parse the REQUIRED keyword, set associated QML property as
required, and introduce a new command, \required, to do this explicitly
in the docs.
Likewise in QML visitor, check for the 'required' keyword for properties.
[ChangeLog][qdoc] Support marking QML properties as required in the
generated documentation.
Fixes: QTBUG-85597
Change-Id: Ib8a25c5ebc1183812aec6e672b557c8fb1196741
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'tests')
6 files changed, 8 insertions, 5 deletions
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-doctest.xml b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-doctest.xml index ad27b8f7f..5953866a1 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-doctest.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-doctest.xml @@ -48,11 +48,12 @@ </db:simplelist> </db:para></db:section> <db:section xml:id="name-prop"> -<db:title>name : string</db:title> +<db:title>[required] name : string</db:title> <db:fieldsynopsis> <db:type>string</db:type> <db:varname>name</db:varname> <db:modifier>writable</db:modifier> +<db:modifier>required</db:modifier> <db:synopsisinfo db:role="access">public</db:synopsisinfo> <db:synopsisinfo db:role="status">active</db:synopsisinfo> <db:synopsisinfo db:role="threadsafeness">unspecified</db:synopsisinfo> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-type.xml b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-type.xml index 32287511b..874f9833b 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-type.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-type.xml @@ -77,11 +77,12 @@ <db:para>A read-only property.</db:para> </db:section> <db:section xml:id="name-prop"> -<db:title>name : string</db:title> +<db:title>[required] name : string</db:title> <db:fieldsynopsis> <db:type>string</db:type> <db:varname>name</db:varname> <db:modifier>writable</db:modifier> +<db:modifier>required</db:modifier> <db:synopsisinfo db:role="access">public</db:synopsisinfo> <db:synopsisinfo db:role="status">active</db:synopsisinfo> <db:synopsisinfo db:role="threadsafeness">unspecified</db:synopsisinfo> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-doctest.html b/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-doctest.html index cfcf156d0..637605f0d 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-doctest.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-doctest.html @@ -69,7 +69,7 @@ <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="name-prop"> <td class="tblQmlPropNode"><p> -<a name="name-prop"></a><span class="name">name</span> : <span class="type">string</span></p></td></tr> +<a name="name-prop"></a><span class="qmlextra">[required] </span><span class="name">name</span> : <span class="type">string</span></p></td></tr> </table></div></div> <div class="qmldoc"><p>Name of the test.</p> <pre class="qml"><span class="type"><a href="qml-qdoc-test-doctest.html">DocTest</a></span> { diff --git a/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-type.html b/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-type.html index 6b0d4f3bd..c5dddd5f1 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-type.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-type.html @@ -115,7 +115,7 @@ <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="name-prop"> <td class="tblQmlPropNode"><p> -<a name="name-prop"></a><span class="name">name</span> : <span class="type">string</span></p></td></tr> +<a name="name-prop"></a><span class="qmlextra">[required] </span><span class="name">name</span> : <span class="type">string</span></p></td></tr> </table></div></div> <div class="qmldoc"><p>Name of the Test.</p> </div></div><!-- @@@name --> diff --git a/tests/auto/qdoc/generatedoutput/testdata/qml/DocTest.qml b/tests/auto/qdoc/generatedoutput/testdata/qml/DocTest.qml index f9eeb49d1..9b4c975f2 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/qml/DocTest.qml +++ b/tests/auto/qdoc/generatedoutput/testdata/qml/DocTest.qml @@ -64,7 +64,7 @@ Item { } \endqml */ - property string name + required property string name /*! Whether the test is active. diff --git a/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp b/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp index 2ae71fece..439738342 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp +++ b/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp @@ -52,6 +52,7 @@ /*! \qmlproperty string QDoc.Test::Type::name + \required \brief Name of the Test. */ |