summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2016-11-15 13:13:29 +0100
committerKai Koehne <kai.koehne@qt.io>2016-11-16 11:42:47 +0000
commit612ccb011671ff2767d2e5b7b8151b39be7c15ad (patch)
tree924b41dfa471eb4fd2e323968b0954f693c0a9ee
parent1d0035c224de525dc532cc34de7c03b7a9ed4520 (diff)
Fix sorting of generatelist
So far the attributions where sorted first for target names (Node::name()), not by the text displayed. Fix this by first doing comparisons based on fullTitle. Also fix the same logic for function lists. Change-Id: Id11f96355665b1aae0499ce2dd0d876d698b10c9 Reviewed-by: Martin Smith <martin.smith@qt.io>
-rw-r--r--src/qdoc/node.cpp65
1 files changed, 33 insertions, 32 deletions
diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp
index 7bec46843..2babb94ab 100644
--- a/src/qdoc/node.cpp
+++ b/src/qdoc/node.cpp
@@ -75,6 +75,39 @@ 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->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())
+ return false;
+ }
+
+ if (n1->type() == Node::Function && n2->type() == Node::Function) {
+ const FunctionNode* f1 = static_cast<const FunctionNode*>(n1);
+ const FunctionNode* f2 = static_cast<const FunctionNode*>(n2);
+
+ if (f1->isConst() < f2->isConst())
+ return true;
+ else if (f1->isConst() > f2->isConst())
+ return false;
+
+ if (f1->signature(false) < f2->signature(false))
+ return true;
+ else if (f1->signature(false) > f2->signature(false))
+ return false;
+ }
+
if (n1->location().filePath() < n2->location().filePath())
return true;
else if (n1->location().filePath() > n2->location().filePath())
@@ -95,38 +128,6 @@ bool Node::nodeNameLessThan(const Node *n1, const Node *n2)
else if (n1->access() > n2->access())
return false;
- if (n1->type() == Node::Function && n2->type() == Node::Function) {
- const FunctionNode* f1 = static_cast<const FunctionNode*>(n1);
- const FunctionNode* f2 = static_cast<const FunctionNode*>(n2);
-
- if (f1->isConst() < f2->isConst())
- return true;
- else if (f1->isConst() > f2->isConst())
- return false;
-
- if (f1->signature(false) < f2->signature(false))
- return true;
- else if (f1->signature(false) > f2->signature(false))
- return false;
- }
-
- 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;
- }
- else 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())
- return false;
- }
-
return false;
}