OSDN Git Service

Ver0.15
[gefu/Gefu.git] / colorsamplemodel.h
1 #ifndef COLORSAMPLEMODEL_H
2 #define COLORSAMPLEMODEL_H
3
4 #include <QAbstractTableModel>
5 #include <QFont>
6 #include <QMap>
7
8 typedef QMap<QString, QColor> ColorMap;
9
10 class ColorSampleModel : public QAbstractTableModel
11 {
12     Q_OBJECT
13 public:
14     explicit ColorSampleModel(QObject *parent = 0);
15
16     const QFont& font() { return m_font; }
17     void setFont(const QFont &font);
18
19     void setColorMap(ColorMap *colorMap) {
20         m_colorMap = colorMap;
21     }
22
23     void update() {
24         beginResetModel();
25         endResetModel();
26     }
27
28 private:
29     ColorMap *m_colorMap;
30     QFont m_font;
31
32 signals:
33
34 public slots:
35
36
37     // QAbstractItemModel interface
38 public:
39     int rowCount(const QModelIndex &parent) const;
40     int columnCount(const QModelIndex &parent) const;
41     QVariant data(const QModelIndex &index, int role) const;
42 };
43
44
45 #endif // COLORSAMPLEMODEL_H