summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/watchhandler.cpp
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2009-01-28 12:15:40 +0100
committerhjk <qtc-committer@nokia.com>2009-01-28 12:15:40 +0100
commiteb021724dfe1653d2f00dc5d3474fa25bb1ee5aa (patch)
treee72890c2f02e10f037c4bbeadc8b1132564e7812 /src/plugins/debugger/watchhandler.cpp
parentb06502387bf3a20e1be73fed84c096bac65c54d8 (diff)
downloadqt-creator-eb021724dfe1653d2f00dc5d3474fa25bb1ee5aa.tar.gz
Fixes: debugger: sort array and list indices numerically
Diffstat (limited to 'src/plugins/debugger/watchhandler.cpp')
-rw-r--r--src/plugins/debugger/watchhandler.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index b2c43b28f6..a00b7fad7c 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -255,7 +255,6 @@ QString WatchData::toString() const
return res;
}
-
static bool iNameSorter(const WatchData &d1, const WatchData &d2)
{
if (d1.level != d2.level)
@@ -265,19 +264,9 @@ static bool iNameSorter(const WatchData &d1, const WatchData &d2)
QString name1 = d1.iname.section('.', level, level);
QString name2 = d2.iname.section('.', level, level);
//MODEL_DEBUG(" SORT: " << name1 << name2 << (name1 < name2));
-
- if (name1 != name2) {
- // This formerly used inames. in this case 'lastIndexOf' probably
- // makes more sense.
- if (name1.startsWith('[') && name2.startsWith('[')) {
- return name1.mid(1, name1.indexOf(']') - 1).toInt()
- < name2.mid(1, name2.indexOf(']') - 1).toInt();
- // numbers should be sorted according to their numerical value
- //int pos = d1.name.lastIndexOf('.');
- //if (pos != -1 && pos + 1 != d1.name.size() && d1.name.at(pos + 1).isDigit())
- // return d1.name.size() < d2.name.size();
- // fall through
- }
+ if (name1 != name2 && !name1.isEmpty() && !name2.isEmpty()) {
+ if (name1.at(0).isDigit() && name2.at(0).isDigit())
+ return name1.toInt() < name2.toInt();
return name1 < name2;
}
}