Schim
text.h
1 #ifndef TEXT_H
2 #define TEXT_H
3 
4 #include "model/object.h"
5 #include "model/entity.h"
6 #include "model/variable.h"
7 
8 #include <QRectF>
9 #include <QString>
10 
17 class Text : public Object
18 {
19 public:
20  // CONSTRUCTORS
24  explicit Text(const QString &text = "");
28  Text(const Text &text);
29  Object *clone() const override;
30 
31  // GETTERS
32  QPointF getPos() const override;
33  QString getText() const;
34  QString getDisplayText(const VariableSet &variableList) const;
35  QString getDisplayText(const Entity *context) const;
36  float getTextHeight() const;
37  QString getFont() const;
38  QString getProperty(const QString &name) const override;
39 
40  // SETTERS
41  void setPos(const QPointF &pos) override;
42  void setText(const QString &text);
43  void setTextHeight(float height);
44  void setFont(const QString &name);
45  void setProperty(const QString &name, const QString &value) override;
46 
47  // OPERATORS
48  bool operator==(const Text &obj) const;
49  bool operator!=(const Text &obj) const;
50 
51 private:
52  QString text, font = "Sans Serif";
53  QPointF pos;
54  float textHeight = 4;
55 };
56 
57 #endif // TEXT_H
The abstract base class for all objects in a sheet.
Definition: object.h:21
Definition: variableset.h:4
void setPos(const QPointF &pos) override
Set the position of the object in the sheet.
Base class for entities.
Definition: entity.h:32
Text(const QString &text="")
Usual way to construct a text object.
QPointF getPos() const override
Return the position of the object in the sheet.
A visual text object.
Definition: text.h:17