diff options
author | Paul Wicking <paul.wicking@qt.io> | 2018-07-12 14:56:19 +0200 |
---|---|---|
committer | Paul Wicking <paul.wicking@qt.io> | 2018-07-18 06:36:59 +0000 |
commit | 3ecb48a25ae72c918c6d8c4486254aeb418e4828 (patch) | |
tree | 385038fa4ddd2387e4cde37263cb8e493676d2e6 | |
parent | 41342facfa10a6a69ec6e23e629975cd0263e39e (diff) | |
download | qttools-3ecb48a25ae72c918c6d8c4486254aeb418e4828.tar.gz |
QDoc: Check aggregates with Node::nodeNameLessThan to improve sorting
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ƶ <topi.reinio@qt.io>
Reviewed-by: Martin Smith <martin.smith@qt.io>
-rw-r--r-- | src/qdoc/node.cpp | 14 |
1 files 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<const DocumentNode*>(n1); - const DocumentNode* f2 = static_cast<const DocumentNode*>(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<const Aggregate*>(n1); + const Aggregate* f2 = static_cast<const Aggregate*>(n2); - if (n1->isCollectionNode() && n2->isCollectionNode()) { - const CollectionNode* f1 = static_cast<const CollectionNode*>(n1); - const CollectionNode* f2 = static_cast<const CollectionNode*>(n2); if (f1->fullTitle() < f2->fullTitle()) return true; else if (f1->fullTitle() > f2->fullTitle()) |