src/linetypes/errorline.cpp

changeset 200
ca23936b455b
parent 199
6988973515d2
child 201
5d201ee4a9c3
equal deleted inserted replaced
199:6988973515d2 200:ca23936b455b
1 #include <QBrush>
2 #include "errorline.h"
3
4 ldraw::ErrorLine::ErrorLine(QStringView text, QStringView message) :
5 text{text.toString()},
6 message{message.toString()}
7 {
8 }
9
10 QVariant ldraw::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 void ldraw::ErrorLine::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair)
24 {
25 LDRAW_OBJECT_HANDLE_SET_PROPERTY(Text, {this->text = value;});
26 LDRAW_OBJECT_HANDLE_SET_PROPERTY(ErrorMessage, {this->message = value;});
27 BaseClass::setProperty(result, pair);
28 }
29
30 QString ldraw::ErrorLine::textRepresentation() const
31 {
32 return this->text;
33 }
34
35 QBrush ldraw::ErrorLine::textRepresentationForeground() const
36 {
37 return QBrush{Qt::yellow};
38 }
39
40 QBrush ldraw::ErrorLine::textRepresentationBackground() const
41 {
42 return QBrush{Qt::red};
43 }
44
45 ldraw::Object::Type ldraw::ErrorLine::typeIdentifier() const
46 {
47 return Type::ErrorLine;
48 }
49
50 QDataStream &ldraw::ErrorLine::serialize(QDataStream &stream) const
51 {
52 return ldraw::Object::serialize(stream) << this->text;
53 }
54
55 QDataStream &ldraw::ErrorLine::deserialize(QDataStream &stream)
56 {
57 return ldraw::Object::deserialize(stream) >> this->text;
58 }
59
60 QString ldraw::ErrorLine::toLDrawCode() const
61 {
62 return this->text;
63 }
64
65 QString ldraw::ErrorLine::iconName() const
66 {
67 return ":/icons/linetype-errorline.png";
68 }
69
70 QString ldraw::ErrorLine::typeName() const
71 {
72 return QObject::tr("error line");
73 }

mercurial