-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglyph.h
75 lines (57 loc) · 2 KB
/
glyph.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef GLYPH_H
#define GLYPH_H
#include <QImage>
#include <QQuickPaintedItem>
class FontSelector;
class Glyph : public QQuickPaintedItem
{
Q_OBJECT
Q_PROPERTY(FontSelector *fontSelector READ fontSelector WRITE setFontSelector NOTIFY fontSelectorChanged)
Q_PROPERTY(int charCode READ charCode WRITE setCharCode NOTIFY charCodeChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
Q_PROPERTY(QString glyph READ glyph NOTIFY glyphChanged)
Q_PROPERTY(bool renderAsText READ renderAsText WRITE setRenderAsText NOTIFY renderAsTextChanged)
FontSelector *m_fontSelector = nullptr;
int m_charCode = 0;
QString m_glyph;
int m_baseline;
QColor m_color;
QImage m_image;
QSize m_size;
QColor m_backgroundColor;
bool m_renderAsText = false;
public:
explicit Glyph(QQuickItem *parent = nullptr);
~Glyph() override;
// QQmlParserStatus interface
virtual void componentComplete() override;
FontSelector *fontSelector() const;
void setFontSelector(FontSelector *fontSelector);
int charCode() const;
void setCharCode(int charCode);
// QQuickPaintedItem interface
virtual void paint(QPainter *painter) override;
QColor color() const;
void setColor(QColor color);
QSize size() const;
QString glyph() const;
const QImage &image() const;
QImage &image();
QColor backgroundColor() const;
void setBackgroundColor(QColor backgroundColor);
bool renderAsText() const;
void setRenderAsText(bool renderAsText);
public slots:
void fix();
signals:
void fontSelectorChanged();
void charCodeChanged();
void colorChanged();
void sizeChanged();
void glyphChanged();
void backgroundColorChanged();
void renderAsTextChanged();
};
#endif // GLYPH_H