forked from mdimura/SRHDDumpReader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEquipmentTableModel.h
46 lines (38 loc) · 1.18 KB
/
EquipmentTableModel.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
#ifndef EQUIPMENTTABLEMODEL_H
#define EQUIPMENTTABLEMODEL_H
#include <QAbstractTableModel>
#include <QMap>
#include <QColor>
#include <iostream>
class Galaxy;
bool operator<(const QColor & a, const QColor & b);
class EquipmentTableModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit EquipmentTableModel(const Galaxy* galaxy, QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const ;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole);
void reload()
{
beginResetModel();
endResetModel();
colors.clear();
}
void initialiseFilterWidgets();
QString colorName(const QColor& c) const {
return colorNames.value(c.rgb(),c.name());
}
signals:
public slots:
private:
const Galaxy *_galaxy;
QMap<int,QColor> colors;
QMap<QRgb,QString> colorNames;
};
#endif // EQUIPMENTTABLEMODEL_H