1 #include <QBrush> |
1 #include <QBrush> |
2 #include "errorline.h" |
2 #include "errorline.h" |
3 |
3 |
4 modelobjects::ErrorLine::ErrorLine(QStringView text, QStringView message) : |
4 linetypes::ErrorLine::ErrorLine(QStringView text, QStringView message) : |
5 text{text.toString()}, |
5 text{text.toString()}, |
6 message{message.toString()} |
6 message{message.toString()} |
7 { |
7 { |
8 } |
8 } |
9 |
9 |
10 QVariant modelobjects::ErrorLine::getProperty(Property property) const |
10 QVariant linetypes::ErrorLine::getProperty(Property property) const |
11 { |
11 { |
12 switch (property) |
12 switch (property) |
13 { |
13 { |
14 case Property::Text: |
14 case Property::Text: |
15 return this->text; |
15 return this->text; |
16 case Property::ErrorMessage: |
16 case Property::ErrorMessage: |
17 return this->message; |
17 return this->message; |
18 default: |
18 default: |
19 return BaseObject::getProperty(property); |
19 return Object::getProperty(property); |
20 } |
20 } |
21 } |
21 } |
22 |
22 |
23 auto modelobjects::ErrorLine::setProperty( |
23 auto linetypes::ErrorLine::setProperty( |
24 Property property, |
24 Property property, |
25 const QVariant& value) |
25 const QVariant& value) |
26 -> SetPropertyResult |
26 -> SetPropertyResult |
27 { |
27 { |
28 switch (property) |
28 switch (property) |
32 return SetPropertyResult::Success; |
32 return SetPropertyResult::Success; |
33 case Property::ErrorMessage: |
33 case Property::ErrorMessage: |
34 this->message = value.toString(); |
34 this->message = value.toString(); |
35 return SetPropertyResult::Success; |
35 return SetPropertyResult::Success; |
36 default: |
36 default: |
37 return BaseObject::setProperty(property, value); |
37 return Object::setProperty(property, value); |
38 } |
38 } |
39 } |
39 } |
40 |
40 |
41 QString modelobjects::ErrorLine::textRepresentation() const |
41 QString linetypes::ErrorLine::textRepresentation() const |
42 { |
42 { |
43 return this->text; |
43 return this->text; |
44 } |
44 } |
45 |
45 |
46 QBrush modelobjects::ErrorLine::textRepresentationForeground() const |
46 QBrush linetypes::ErrorLine::textRepresentationForeground() const |
47 { |
47 { |
48 return QBrush{Qt::yellow}; |
48 return QBrush{Qt::yellow}; |
49 } |
49 } |
50 |
50 |
51 QBrush modelobjects::ErrorLine::textRepresentationBackground() const |
51 QBrush linetypes::ErrorLine::textRepresentationBackground() const |
52 { |
52 { |
53 return QBrush{Qt::red}; |
53 return QBrush{Qt::red}; |
54 } |
54 } |