src/linetypes/errorline.cpp

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

mercurial