-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextShape.h
More file actions
33 lines (25 loc) · 839 Bytes
/
Copy pathTextShape.h
File metadata and controls
33 lines (25 loc) · 839 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
#ifndef TEXTSHAPE_H
#define TEXTSHAPE_H
#include "Shape.h"
class TextShape : public Shape
{
public:
QString shapeType() const override { return "Text"; }
std::unique_ptr<Shape> clone() const override;
QString text() const { return m_text; }
void setText(const QString &t);
QString fontFamily() const { return m_fontFamily; }
void setFontFamily(const QString &f);
double fontSize() const { return m_fontSize; }
void setFontSize(double s);
/// Recompute transform height from font metrics and text width.
void syncBoundsToText();
protected:
QJsonObject typeSpecificToJson() const override;
void typeSpecificFromJson(const QJsonObject &obj) override;
private:
QString m_text = "Text";
QString m_fontFamily = "sans-serif";
double m_fontSize = 24.0;
};
#endif // TEXTSHAPE_H