-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpenmodel.h
More file actions
41 lines (35 loc) · 1016 Bytes
/
penmodel.h
File metadata and controls
41 lines (35 loc) · 1016 Bytes
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
#ifndef PENMODEL_H
#define PENMODEL_H
#include <QAbstractTableModel>
#include <QBrush>
#include <QPair>
#include <QPen>
#include <QMap>
#include <QSet>
class PenModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit PenModel(QObject *parent = 0);
enum Columns {
Glyph,
PenColor,
BrushColor,
NumColumns
};
QPair<QPen, QBrush> glyphConfig(char glyph) const;
// QAbstractItemModel interface
public:
int rowCount(const QModelIndex &parent) const;
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
Qt::ItemFlags flags(const QModelIndex &index) const;
public slots:
void setVisibleGlyphs(QSet<char> glyphs);
private:
QMap<char, QPair<QPen,QBrush> > glyphData;
QList<char> glyphList;
};
#endif // PENMODEL_H