Sat, 05 Oct 2019 23:47:03 +0300
added the settings editor
6 | 1 | #include <QBrush> |
3 | 2 | #include "errorline.h" |
3 | ||
4 | modelobjects::ErrorLine::ErrorLine(QStringView text) : | |
5 | text{text.toString()} | |
6 | { | |
7 | } | |
8 | ||
9 | QVariant modelobjects::ErrorLine::getProperty(Property property) const | |
10 | { | |
11 | switch (property) | |
12 | { | |
13 | case Property::Text: | |
14 | return text; | |
15 | default: | |
16 | return BaseObject::getProperty(property); | |
17 | } | |
18 | } | |
19 | ||
20 | auto modelobjects::ErrorLine::setProperty( | |
21 | Property property, | |
22 | const QVariant& value) | |
23 | -> SetPropertyResult | |
24 | { | |
25 | switch (property) | |
26 | { | |
27 | case Property::Text: | |
28 | text = value.toString(); | |
29 | return SetPropertyResult::Success; | |
30 | default: | |
31 | return BaseObject::setProperty(property, value); | |
32 | } | |
33 | } | |
6 | 34 | |
35 | QString modelobjects::ErrorLine::textRepresentation() const | |
36 | { | |
37 | return this->text; | |
38 | } | |
39 | ||
40 | QBrush modelobjects::ErrorLine::textRepresentationForeground() const | |
41 | { | |
42 | return QBrush{Qt::yellow}; | |
43 | } | |
44 | ||
45 | QBrush modelobjects::ErrorLine::textRepresentationBackground() const | |
46 | { | |
47 | return QBrush{Qt::red}; | |
48 | } |