-
Notifications
You must be signed in to change notification settings - Fork 0
/
teamlistdatamodel.h
51 lines (39 loc) · 1.18 KB
/
teamlistdatamodel.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
48
49
50
51
#ifndef TEAMLISTDATAMODEL_H
#define TEAMLISTDATAMODEL_H
#include <QAbstractTableModel>
#include <qflags.h>
#include <qfontmetrics.h>
#include <qhash.h>
#include <qlist.h>
#include <entrydatastore.h>
class TeamListDataModel : public QAbstractTableModel
{
Q_OBJECT
public:
enum ColumnType {
INVALID,
TEAM_NUMBER,
GEAR_HIGH,
CLIMB_LOW,
GEAR_AVG,
CLIMB_AVG,
CLIMB_RATE,
SELECTABLE
};
TeamListDataModel(EntryDataStore& store, const QFont& font, QObject* parent = nullptr);
~TeamListDataModel();
int columnCount(const QModelIndex& parent = QModelIndex()) const;
int rowCount(const QModelIndex& parent = QModelIndex()) const;
QVariant data(const QModelIndex& index, int role) const;
bool setData(const QModelIndex& index, const QVariant& value, int role);
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex& index) const;
void setSortOrder(EntryDataStore::SortOrder order);
private:
ColumnType columnType(int col) const;
static QFlags<Qt::AlignmentFlag> columnAlignment(int col);
QHash<int, bool> team_selections;
EntryDataStore& data_store;
QFontMetrics font_metrics;
};
#endif // TEAMLISTDATAMODEL_H