diff options
author | Luca Di Sera <luca.disera@qt.io> | 2022-10-13 13:25:31 +0200 |
---|---|---|
committer | Luca Di Sera <luca.disera@qt.io> | 2022-10-13 14:16:30 +0200 |
commit | 895c5173447d109aa29214b791f6afe0d8757a71 (patch) | |
tree | 77ac2e7f0d49b53dc1ef501968ef6b382be71d7d /tests/auto/qdoc/generatedoutput/expected_output/docbook | |
parent | 3f5f00caf289f3985c81158d5c942fcff919c667 (diff) | |
download | qttools-895c5173447d109aa29214b791f6afe0d8757a71.tar.gz |
QDoc: Fix ordering of overloads for QML Types
When QDoc generates a page for a QML type, as a result of the "\qmltype"
topic command, it generates, similarly to C++, a summary list of
members, a detailed list of members and a separate page listing a
summary of all members of the type.
Internally, QDoc uses two coupled classes, `Section` and `Sections`, to
destructure an `Aggregate`, the internal representation of documentable
element that are composed of multiple documentable elements, such as a
QML Type, into a series of ordered categories of child elements.
Those categories are later used to generate the various "sections" of
the `Aggregate` documentation, such as the various list, as described
above, for a QML Type.
The ordering of all those "sections" is given based on the results of
the free-function `sortName` in "sections.cpp".
`sortName` produces ordered strings based on a `Node`'s name.
When QDoc parses QML methods that are overloads, as it does for C++, it
assigns an "overload number" to each of them, to discern the various
equally named elements.
One of the elements is considered the "primary overload", to which no
number is assigned, and all other elements are considered "non-primary
overloads", to which an increasing positive integer "overload number" is
assigned.
Due to the current implementation of `sortName`, the "overload number"
is not considered when sorting the methods of a QML Type, contrary to
the behavior reserved for C++ overloads.
As a consequence, the various overloads in a section are ordered based
on the implementation details of their storing mechanism and sorting
algorithm.
In particular, in our specific case where a red-black tree map is used,
they are ordered in descending order of their overload number.
For example, given some method named X and a few of its overload X-1,
X-2 and X-3, the "sections" listing the overloads will order them as
x-3, X-2, X-1, X.
While the assignment of the "overload number", currently, generally only
follows the order in which QDoc encounters the various overloads, such
that it may not be consistent between source files or versions of the
code, it generally follows, in the Qt codebase, a "better looking"
order, where overloads with a "more complex" signature appear after
their peers with a "simpler" signature.
Furthermore, we enforce an ascending order for C++ overloads based on
the overload number, contrary to the current behavior for QML overloads.
Hence, to increase the consistency between the ordering of overloads in
C++ and QML documentation and possibly provide a "better looking"
output, `sortName` was modified to take into account the "overload
number" for QML overloads.
The regression files for `tst_generatedOutput` were regenerated to take
into account the ordering change.
Change-Id: I904ec35e428e8b0b1740826eb6ad9726a261938a
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'tests/auto/qdoc/generatedoutput/expected_output/docbook')
-rw-r--r-- | tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-abstractparent.xml | 8 | ||||
-rw-r--r-- | tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-child.xml | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-abstractparent.xml b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-abstractparent.xml index 647b6e6ed..154b70b0f 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-abstractparent.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-abstractparent.xml @@ -63,14 +63,14 @@ </db:section> <db:section xml:id="method-documentation"> <db:title>Method Documentation</db:title> -<db:section xml:id="name-method-1"> -<db:title>void name()</db:title> -<db:para>Name all children with random names.</db:para> -</db:section> <db:section xml:id="name-method"> <db:title>void name(Child <db:emphasis>child</db:emphasis>, <db:emphasis>name</db:emphasis>)</db:title> <db:para>Name a <db:code role="parameter">child</db:code> using <db:code role="parameter">name</db:code>.</db:para> </db:section> +<db:section xml:id="name-method-1"> +<db:title>void name()</db:title> +<db:para>Name all children with random names.</db:para> +</db:section> <db:section xml:id="rear-method"> <db:title>void rear(Child <db:emphasis>child</db:emphasis>, var <db:emphasis>method</db:emphasis> = Strict)</db:title> <db:para>Do some abstract parenting on <db:code role="parameter">child</db:code> using a specific <db:code role="parameter">method</db:code>.</db:para> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-child.xml b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-child.xml index 0537a3ffc..76df460b7 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-child.xml +++ b/tests/auto/qdoc/generatedoutput/expected_output/docbook/qml-qdoc-test-child.xml @@ -63,14 +63,14 @@ </db:section> <db:section xml:id="method-documentation"> <db:title>Method Documentation</db:title> -<db:section xml:id="name-method-1"> -<db:title>void name()</db:title> -<db:para>Name all children with random names.</db:para> -</db:section> <db:section xml:id="name-method"> <db:title>void name(Child <db:emphasis>child</db:emphasis>, <db:emphasis>name</db:emphasis>)</db:title> <db:para>Name a <db:code role="parameter">child</db:code> of this child using <db:code role="parameter">name</db:code>.</db:para> </db:section> +<db:section xml:id="name-method-1"> +<db:title>void name()</db:title> +<db:para>Name all children with random names.</db:para> +</db:section> <db:section xml:id="rear-method"> <db:title>void rear(Child <db:emphasis>child</db:emphasis>, var <db:emphasis>method</db:emphasis> = Strict)</db:title> <db:para>Do some abstract parenting on <db:code role="parameter">child</db:code> using a specific <db:code role="parameter">method</db:code>.</db:para> |