-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsortproxy.h
47 lines (28 loc) · 1.1 KB
/
sortproxy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef SORTPROXY_H
#define SORTPROXY_H
#include <QSortFilterProxyModel>
#include <QObject>
#include "vault.h"
class SortProxy : public QSortFilterProxyModel
{
Q_OBJECT
public:
enum SortCriterion {PeakID, PeakName, Name, YearSeason, Date, Time, Citizenship,
Gender, Age,}; // every field except O2 usage and causeOfDeath and Summiter
enum SortOrder {Ascending, Descending};
public:
SortProxy(QObject* parent = nullptr);
SortProxy(QObject* parent, const QMap<QString, Summiter*>* summiters);
void setSummiters(const QMap<QString, Summiter*>* contents) {_summiters = contents; }
void setSortField(SortCriterion sortField) { field = sortField; }
void setSortOrder(SortOrder sortOrder) { order = sortOrder; }
protected:
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
QString getField(const QString& name) const;
private:
const QMap<QString, Summiter*>* _summiters;
protected:
SortCriterion field;
SortOrder order;
};
#endif // SORTPROXY_H