Thu, 03 Oct 2019 23:44:28 +0300
language support
6 | 1 | #include <QFont> |
3 | 2 | #include "comment.h" |
3 | ||
4 | modelobjects::Comment::Comment(QStringView text) : | |
5 | BaseObject{}, | |
6 | storedText{text.toString()} {} | |
7 | ||
8 | QVariant modelobjects::Comment::getProperty(Property property) const | |
9 | { | |
10 | switch (property) | |
11 | { | |
12 | case Property::Text: | |
13 | return storedText; | |
14 | default: | |
15 | return BaseObject::getProperty(property); | |
16 | } | |
17 | } | |
18 | ||
19 | auto modelobjects::Comment::setProperty(Property property, const QVariant& value) | |
20 | -> SetPropertyResult | |
21 | { | |
22 | switch (property) | |
23 | { | |
24 | case Property::Text: | |
25 | storedText = value.toString(); | |
26 | return SetPropertyResult::Success; | |
27 | default: | |
28 | return BaseObject::setProperty(property, value); | |
29 | } | |
30 | } | |
6 | 31 | |
32 | QString modelobjects::Comment::textRepresentation() const | |
33 | { | |
34 | return this->storedText; | |
35 | } | |
36 | ||
37 | QFont modelobjects::Comment::textRepresentationFont() const | |
38 | { | |
39 | QFont font; | |
40 | font.setItalic(true); | |
41 | return font; | |
42 | } |