1
0
Fork 0

Merge pull request #3165 from HayFieldLaps/memory-map-view-sort

Add secondary sorting to Memory Map
This commit is contained in:
Duncan Ogilvie 2023-08-10 17:33:12 +02:00 committed by GitHub
commit 6a970e657d
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 15 deletions

View File

@ -11,29 +11,17 @@ StdTable::StdTable(QWidget* parent) : AbstractStdTable(parent)
bool StdTable::SortBy::AsText(const QString & a, const QString & b)
{
auto i = QString::compare(a, b);
if(i < 0)
return true;
if(i > 0)
return false;
return duint(&a) < duint(&b);
return i < 0;
}
bool StdTable::SortBy::AsInt(const QString & a, const QString & b)
{
if(a.toLongLong() < b.toLongLong())
return true;
if(a.toLongLong() > b.toLongLong())
return false;
return duint(&a) < duint(&b);
return a.toLongLong() < b.toLongLong();
}
bool StdTable::SortBy::AsHex(const QString & a, const QString & b)
{
if(a.toLongLong(0, 16) < b.toLongLong(0, 16))
return true;
if(a.toLongLong(0, 16) > b.toLongLong(0, 16))
return false;
return duint(&a) < duint(&b);
return a.toLongLong(0, 16) < b.toLongLong(0, 16);
}
/************************************************************************************