SpellModel, SortFilterItemModel: case insensitive sorting

This commit is contained in:
scrawl 2014-12-24 15:41:48 +01:00
parent 2e5e7370ba
commit 6f72989cb1
2 changed files with 10 additions and 5 deletions

View file

@ -1,5 +1,7 @@
#include "sortfilteritemmodel.hpp" #include "sortfilteritemmodel.hpp"
#include <components/misc/stringops.hpp>
#include <components/esm/loadalch.hpp> #include <components/esm/loadalch.hpp>
#include <components/esm/loadappa.hpp> #include <components/esm/loadappa.hpp>
#include <components/esm/loadarmo.hpp> #include <components/esm/loadarmo.hpp>
@ -52,9 +54,10 @@ namespace
if (left.mBase.getTypeName() == right.mBase.getTypeName()) if (left.mBase.getTypeName() == right.mBase.getTypeName())
{ {
int cmp = left.mBase.getClass().getName(left.mBase).compare( std::string leftName = Misc::StringUtils::lowerCase(left.mBase.getClass().getName(left.mBase));
right.mBase.getClass().getName(right.mBase)); std::string rightName = Misc::StringUtils::lowerCase(right.mBase.getClass().getName(right.mBase));
return cmp < 0;
return leftName.compare(rightName) < 0;
} }
else else
return compareType(left.mBase.getTypeName(), right.mBase.getTypeName()); return compareType(left.mBase.getTypeName(), right.mBase.getTypeName());

View file

@ -21,8 +21,10 @@ namespace
if (left.mType != right.mType) if (left.mType != right.mType)
return left.mType < right.mType; return left.mType < right.mType;
int cmp = left.mName.compare(right.mName); std::string leftName = Misc::StringUtils::lowerCase(left.mName);
return cmp < 0; std::string rightName = Misc::StringUtils::lowerCase(right.mName);
return leftName.compare(rightName) < 0;
} }
} }