QDoc: Improve parsing of \qmlmethod and \qmlsignal arguments
CppCodeParser used an ad-hoc string parsing logic to extract
information about the argument passed to \qmlmethod and
\qmlsignal QDoc commands. Validating the argument string was
missing key checks; a return type could be omitted and
methods did not require a parameter list enclosed in
paretheses.
Extend QmlPropertyArguments with a feature to parse also
method/signal signatures. Introduce two new warnings for a
\qmlmethod: Missing return type, and a failure to parse
the parameter list.
A valid syntax for a \qmlsignal remains otherwise identical
to a \qmlproperty, with the exception that a type is not
required, and a parameter list can, but is not required to,
appear after the signal name. A valid syntax for \qmlmethod
now always requires both a return type and a parameter list,
same as for an \fn command.
[ChangeLog][QDoc] QDoc now warns if \qmlmethod signatures
do not document the return type.
Fixes: QTBUG-136456
Change-Id: I5abd6f267341a0bb1a015e645a19bbe9048d6702
Reviewed-by: David Boddie <david.boddie@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
| commit | 73438a25fa556df272762fbce119f4972b007450 |
| parent | 9d84dcccf17699a72b1a0befde54160afdba6228 |
| author | Topi Reinio <topi.reinio@qt.io> |
| committer | Topi Reinio <topi.reinio@qt.io> |
| commit time | Mon, 23 Feb 2026 10:57:49 +0000 |
- M src/qdoc/qdoc/doc/qdoc-manual-topiccmds.qdoc
- M src/qdoc/qdoc/src/qdoc/cppcodeparser.cpp
- M src/qdoc/qdoc/src/qdoc/qmlpropertyarguments.cpp
- M src/qdoc/qdoc/src/qdoc/qmlpropertyarguments.h
- M src/qdoc/qdoc/tests/generatedoutput/testdata/noautolist/src/qml/type.cpp
- M src/qdoc/qdoc/tests/generatedoutput/testdata/qmlpropertygroups/src/qml/type.cpp
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject/comprehensiveproject.qdocconf
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject/expected/docbook/qml-qdoc-test-type.xml
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject/expected/html/Test-qdoc-warnings.log
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject/expected/html/qml-qdoc-test-type-members.html
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject/expected/html/qml-qdoc-test-type-obsolete.html
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject/expected/html/qml-qdoc-test-type.html
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject/expected/html/test.index
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject/expected/html/testtagfile.tags
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject/expected/webxml/testtagfile.tags
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject/src/qml/type.cpp
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject_headerdocs/expected/docbook/qml-qdoc-test-type.xml
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject_headerdocs/expected/html/qml-qdoc-test-type-members.html
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject_headerdocs/expected/html/qml-qdoc-test-type-obsolete.html
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject_headerdocs/expected/html/qml-qdoc-test-type.html
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject_headerdocs/expected/html/test.index
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject_headerdocs/expected/html/testtagfile.tags
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject_headerdocs/expected/webxml/testtagfile.tags
- M src/qdoc/qdoc/tests/validateqdocoutputfiles/testdata/comprehensiveproject_headerdocs/src/qml/type.qdoc