mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
Ref T529, deterministic sort order when column values are equal
* the Qt model sorts by column * when multiple values have the same column value the order among those is more or less random * added additional property indexes to determine the order among the equal values
This commit is contained in:
committed by
Mat Sutcliffe
parent
17f67d6106
commit
8c15f45007
@@ -120,6 +120,9 @@ namespace BlackMisc
|
||||
//! Convert string to DB key
|
||||
static int stringToDbKey(const QString &candidate);
|
||||
|
||||
//! The key index
|
||||
static const CPropertyIndex &keyIndex() { static const CPropertyIndex k(IndexDbIntegerKey); return k; }
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
IDatastoreObjectWithIntegerKey() {}
|
||||
@@ -201,6 +204,9 @@ namespace BlackMisc
|
||||
//! Invalid key
|
||||
static QString invalidDbKey() { return {}; }
|
||||
|
||||
//! The key index
|
||||
static const CPropertyIndex &keyIndex() { static const CPropertyIndex k(IndexDbStringKey); return k; }
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
IDatastoreObjectWithStringKey() {}
|
||||
|
||||
@@ -20,4 +20,12 @@ namespace BlackMisc
|
||||
CSequence<CPropertyIndex>(other)
|
||||
{ }
|
||||
|
||||
CPropertyIndexList CPropertyIndexList::copyFrontRemoved() const
|
||||
{
|
||||
if (this->size() < 2) { return CPropertyIndexList(); }
|
||||
CPropertyIndexList copy(*this);
|
||||
copy.pop_front();
|
||||
return copy;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace BlackMisc
|
||||
|
||||
//! Construct from a base class object.
|
||||
CPropertyIndexList(const CSequence<CPropertyIndex> &other);
|
||||
|
||||
//! List without front element, or empty list if not applicable
|
||||
CPropertyIndexList copyFrontRemoved() const;
|
||||
};
|
||||
} //namespace
|
||||
|
||||
|
||||
Reference in New Issue
Block a user