Add a "sort role" for sorting the dive list

By default, sorting is done by the display role, but then we end up
sorting by the string we display, which is almost always the wrong thing.

So this adds a new "SORT_ROLE" that is used for sorting, and then the
data lookup can return the raw data we want to sort by.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2013-05-29 14:54:39 +09:00 committed by Dirk Hohndel
parent 8df20f4149
commit bb77f5a44e
3 changed files with 29 additions and 1 deletions

View file

@ -124,7 +124,7 @@ public:
enum Column {NR, DATE, RATING, DEPTH, DURATION, TEMPERATURE, TOTALWEIGHT,
SUIT, CYLINDER, NITROX, SAC, OTU, MAXCNS, LOCATION, COLUMNS };
enum ExtraRoles{STAR_ROLE = Qt::UserRole + 1, DIVE_ROLE};
enum ExtraRoles{STAR_ROLE = Qt::UserRole + 1, DIVE_ROLE, SORT_ROLE};
virtual ~TreeItemDT();
int columnCount() const {