fix size column sorting

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2024-06-09 23:53:40 +03:00
parent 34e1a5e660
commit 242ddbb7e1
9 changed files with 48 additions and 62 deletions

View File

@ -94,29 +94,24 @@ std::pair<Version, Version> ResourcePack::compatibleVersions() const
return s_pack_format_versions.constFind(m_pack_format).value();
}
std::pair<int, bool> ResourcePack::compare(const Resource& other, SortType type) const
int ResourcePack::compare(const Resource& other, SortType type, Qt::SortOrder order) const
{
auto const& cast_other = static_cast<ResourcePack const&>(other);
switch (type) {
default: {
auto res = Resource::compare(other, type);
if (res.first != 0)
return res;
break;
}
default:
return Resource::compare(other, type, order);
case SortType::PACK_FORMAT: {
auto this_ver = packFormat();
auto other_ver = cast_other.packFormat();
if (this_ver > other_ver)
return { 1, type == SortType::PACK_FORMAT };
return 1;
if (this_ver < other_ver)
return { -1, type == SortType::PACK_FORMAT };
return -1;
break;
}
}
return { 0, false };
return 0;
}
bool ResourcePack::applyFilter(QRegularExpression filter) const