From 3ecb48a25ae72c918c6d8c4486254aeb418e4828 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Thu, 12 Jul 2018 14:56:19 +0200 Subject: QDoc: Check aggregates with Node::nodeNameLessThan to improve sorting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Certain corner cases were not covered by the current implementation, causing the sort to fail. This change aims to make QDoc capable of sorting all nodes derived from aggregate, because an aggregate can be expected to have a user visible title that can be used to sort content alphabetically. Impressively, this has been working for most lists of classes in the generated docs, just not all. Task-number: QTBUG-67530 Change-Id: I5b5b19011c6a1e561894f8155c971da60aff7e2f Reviewed-by: Topi Reiniƶ Reviewed-by: Martin Smith --- src/qdoc/node.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp index de2fec53d..046467a94 100644 --- a/src/qdoc/node.cpp +++ b/src/qdoc/node.cpp @@ -77,18 +77,10 @@ void Node::initialize() bool Node::nodeNameLessThan(const Node *n1, const Node *n2) { - if (n1->isDocumentNode() && n2->isDocumentNode()) { - const DocumentNode* f1 = static_cast(n1); - const DocumentNode* f2 = static_cast(n2); - if (f1->fullTitle() < f2->fullTitle()) - return true; - else if (f1->fullTitle() > f2->fullTitle()) - return false; - } + if (n1->isAggregate() && n2->isAggregate()) { + const Aggregate* f1 = static_cast(n1); + const Aggregate* f2 = static_cast(n2); - if (n1->isCollectionNode() && n2->isCollectionNode()) { - const CollectionNode* f1 = static_cast(n1); - const CollectionNode* f2 = static_cast(n2); if (f1->fullTitle() < f2->fullTitle()) return true; else if (f1->fullTitle() > f2->fullTitle()) -- cgit v1.2.1