From 4f8bb92f9654efd6cc5dc7c6b08979fe3106b3ea Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 22 Jan 2020 14:45:15 +0100 Subject: qdoc: Sort the members of shared comment node collective Nodes sharing a comment will be listed together as a group, so sort them alphabetically. Fixes: QTBUG-81265 Change-Id: Ia8dcba92d74116bf6757bfc9aaded1c65d7271fd Reviewed-by: Paul Wicking --- src/qdoc/cppcodeparser.cpp | 3 +++ src/qdoc/node.h | 4 ++++ .../generatedoutput/expected_output/qml-qdoc-test-type.html | 12 ++++++------ .../qml-qdoc-test-anotherchild-members.html | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index 6a5087583..c60957793 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -455,6 +455,7 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis docs.append(doc); for (const auto n : sharedNodes) scn->append(n); + scn->sort(); } } @@ -947,6 +948,8 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL } } } + for (auto *scn : sharedCommentNodes) + scn->sort(); } } } diff --git a/src/qdoc/node.h b/src/qdoc/node.h index 5a97d194a..739c262b4 100644 --- a/src/qdoc/node.h +++ b/src/qdoc/node.h @@ -952,6 +952,10 @@ public: n->setSharedCommentNode(this); setGenus(n->genus()); } + void sort() + { + std::sort(collective_.begin(), collective_.end(), Node::nodeNameLessThan); + } const QVector &collective() const { return collective_; } void setOverloadFlags(); void setRelatedNonmember(bool b) override; 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 d4c278659..363a4bf16 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 @@ -73,12 +73,12 @@
- - + +

-fourth : int

fifth : int

+fourth : int

A group of properties sharing a documentation comment.

@@ -161,12 +161,12 @@
- - + +

-enable()

disable()

+enable()

Enables or disables this type.

diff --git a/tests/auto/qdoc/generatedoutput/expected_output/qmlpropertygroups/qml-qdoc-test-anotherchild-members.html b/tests/auto/qdoc/generatedoutput/expected_output/qmlpropertygroups/qml-qdoc-test-anotherchild-members.html index 557061cc0..aa80b49df 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/qmlpropertygroups/qml-qdoc-test-anotherchild-members.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/qmlpropertygroups/qml-qdoc-test-anotherchild-members.html @@ -15,9 +15,9 @@

The following members are inherited from Parent.

-- cgit v1.2.3