diff options
author | Topi Reinio <topi.reinio@qt.io> | 2021-01-11 13:50:56 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-01-11 13:26:01 +0000 |
commit | 22cd1490aec3b714314fb7c599f770d886236ede (patch) | |
tree | bf3d2fa2278e88268fcddc6c91bb6b94e2db4734 | |
parent | 7083a7b7c1e5ec121a23ed8b767e112383327cc1 (diff) |
qdoc: Fix addendums for QML signals that contain '.' in the name
QML signals may belong to a group, and the automatic note generation
for corresponding signal handler must take this into account.
Fixes: QTBUG-85572
Change-Id: Ibfc793475618fb78a8ba0a0344537917ad6fb0bf
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 8a20d5b62dec6d45e6d6d29fd894aa362c3301fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
8 files changed, 40 insertions, 4 deletions
diff --git a/src/qdoc/docbookgenerator.cpp b/src/qdoc/docbookgenerator.cpp index 42b242bc7..f721e0ca1 100644 --- a/src/qdoc/docbookgenerator.cpp +++ b/src/qdoc/docbookgenerator.cpp @@ -3435,8 +3435,9 @@ void DocBookGenerator::generateAddendum(const Node *node, Addendum type, CodeMar case QmlSignalHandler: { QString handler(node->name()); - handler[0] = handler[0].toTitleCase(); - handler.prepend(QLatin1String("on")); + int prefixLocation = handler.lastIndexOf('.', -2) + 1; + handler[prefixLocation] = handler[prefixLocation].toTitleCase(); + handler.insert(prefixLocation, QLatin1String("on")); writer->writeStartElement(dbNamespace, "para"); writer->writeCharacters("The corresponding handler is "); writer->writeTextElement(dbNamespace, "code", handler); diff --git a/src/qdoc/generator.cpp b/src/qdoc/generator.cpp index 123a06291..87b74ec56 100644 --- a/src/qdoc/generator.cpp +++ b/src/qdoc/generator.cpp @@ -1365,8 +1365,9 @@ void Generator::generateAddendum(const Node *node, Addendum type, CodeMarker *ma case QmlSignalHandler: { QString handler(node->name()); - handler[0] = handler[0].toTitleCase(); - handler.prepend(QLatin1String("on")); + int prefixLocation = handler.lastIndexOf('.', -2) + 1; + handler[prefixLocation] = handler[prefixLocation].toTitleCase(); + handler.insert(prefixLocation, QLatin1String("on")); text << "The corresponding handler is " << Atom(Atom::FormattingLeft, ATOM_FORMATTING_TELETYPE) << handler << Atom(Atom::FormattingRight, ATOM_FORMATTING_TELETYPE) << "."; 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 874f9833b..0afcb0045 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 @@ -140,6 +140,13 @@ <db:para>The corresponding handler is <db:code>onCompleted</db:code>.</db:para> </db:note> </db:section> +<db:section xml:id="group.created-signal"> +<db:title>group.created()</db:title> +<db:para>This signal is prefixed with <db:emphasis>group</db:emphasis>.</db:para> +<db:note> +<db:para>The corresponding handler is <db:code>group.onCreated</db:code>.</db:para> +</db:note> +</db:section> </db:section> <db:section xml:id="attached-signal-documentation"> <db:title>Attached Signal Documentation</db:title> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-type-members.html b/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-type-members.html index c3866cc66..368bd367d 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-type-members.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/qml-qdoc-test-type-members.html @@ -26,6 +26,7 @@ <li class="fn">Type <b><b><a href="qml-qdoc-test-type.html#copy-method">copy</a></b></b>(<i>a</i>)</li> <li class="fn"><b><b><a href="qml-qdoc-test-type.html#disable-method">disable</a></b></b>()</li> <li class="fn"><b><b><a href="qml-qdoc-test-type.html#enable-method">enable</a></b></b>()</li> +<li class="fn"><b><b><a href="qml-qdoc-test-type.html#group.created-signal">group.created</a></b></b>()</li> </ul> </body> </html> 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 c5dddd5f1..8d603703f 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 @@ -51,6 +51,7 @@ <h2 id="signals">Signals</h2> <ul> <li class="fn"><b><b><a href="qml-qdoc-test-type.html#completed-signal">completed</a></b></b>(int <i>status</i>)</li> +<li class="fn"><b><b><a href="qml-qdoc-test-type.html#group.created-signal">group.created</a></b></b>()</li> </ul> <a name="attached-signals"></a> <h2 id="attached-signals">Attached Signals</h2> @@ -146,6 +147,17 @@ <p><b>Note: </b>The corresponding handler is <code>onCompleted</code>.</p> </div></div><!-- @@@completed --> <br/> +<!-- $$$group.created[overload1]$$$group.created --> +<div class="qmlitem"><div class="qmlproto"> +<div class="table"><table class="qmlname"> +<tr valign="top" class="odd" id="group.created-signal"> +<td class="tblQmlFuncNode"><p> +<a name="group.created-signal"></a><span class="name">group.created</span>()</p></td></tr> +</table></div></div> +<div class="qmldoc"><p>This signal is prefixed with <i>group</i>.</p> +<p><b>Note: </b>The corresponding handler is <code>group.onCreated</code>.</p> +</div></div><!-- @@@group.created --> +<br/> <h2>Attached Signal Documentation</h2> <!-- $$$configured[overload1]$$$configured --> <div class="qmlitem"><div class="qmlproto"> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/test.qhp b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp index 59ccb7059..0faff8362 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/test.qhp +++ b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp @@ -105,6 +105,7 @@ <keyword name="foo" id="DocTest::foo" ref="qml-qdoc-test-doctest.html#foo-signal"/> <keyword name="fourth" id="Type::fourth" ref="qml-qdoc-test-type.html#fourth-prop"/> <keyword name="funcPtr" id="Test::funcPtr" ref="testqdoc-test.html#funcPtr"/> + <keyword name="group.created" id="Type::group.created" ref="qml-qdoc-test-type.html#group.created-signal"/> <keyword name="group.first" id="Type::group.first" ref="qml-qdoc-test-type.html#group.first-prop"/> <keyword name="group.second" id="Type::group.second" ref="qml-qdoc-test-type.html#group.second-prop"/> <keyword name="group.third" id="Type::group.third" ref="qml-qdoc-test-type.html#group.third-prop"/> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testtagfile.tags b/tests/auto/qdoc/generatedoutput/expected_output/testtagfile.tags index 99b8fb2e1..8f4e08bff 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/testtagfile.tags +++ b/tests/auto/qdoc/generatedoutput/expected_output/testtagfile.tags @@ -243,6 +243,13 @@ <name>QDoc.Test.Type</name> <filename>qml-qdoc-test-type.html</filename> <member kind="function" protection="public" virtualness="non" static="no"> + <type></type> + <name>group.created</name> + <anchorfile>qml-qdoc-test-type.html</anchorfile> + <anchor>group.created-signal</anchor> + <arglist>()</arglist> + </member> + <member kind="function" protection="public" virtualness="non" static="no"> <type>Type</type> <name>copy</name> <anchorfile>qml-qdoc-test-type.html</anchorfile> diff --git a/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp b/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp index 31f027ff0..de3929140 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp +++ b/tests/auto/qdoc/generatedoutput/testdata/qml/type.cpp @@ -80,6 +80,12 @@ */ /*! + \qmlsignal Type::group.created + + This signal is prefixed with \e group. +*/ + +/*! \qmlproperty int Type::fourth \qmlproperty int Type::fifth |