Sun, 03 Nov 2019 13:07:04 +0200
fixed translations being updated twice at the same time, that's bad
6 | 1 | #include <QBrush> |
3 | 2 | #include "errorline.h" |
3 | ||
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
4 | modelobjects::ErrorLine::ErrorLine(QStringView text, QStringView message) : |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
5 | text{text.toString()}, |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
6 | message{message.toString()} |
3 | 7 | { |
8 | } | |
9 | ||
10 | QVariant modelobjects::ErrorLine::getProperty(Property property) const | |
11 | { | |
12 | switch (property) | |
13 | { | |
14 | case Property::Text: | |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
15 | return this->text; |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
16 | case Property::ErrorMessage: |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
17 | return this->message; |
3 | 18 | default: |
19 | return BaseObject::getProperty(property); | |
20 | } | |
21 | } | |
22 | ||
23 | auto modelobjects::ErrorLine::setProperty( | |
24 | Property property, | |
25 | const QVariant& value) | |
26 | -> SetPropertyResult | |
27 | { | |
28 | switch (property) | |
29 | { | |
30 | case Property::Text: | |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
31 | this->text = value.toString(); |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
32 | return SetPropertyResult::Success; |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
33 | case Property::ErrorMessage: |
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
6
diff
changeset
|
34 | this->message = value.toString(); |
3 | 35 | return SetPropertyResult::Success; |
36 | default: | |
37 | return BaseObject::setProperty(property, value); | |
38 | } | |
39 | } | |
6 | 40 | |
41 | QString modelobjects::ErrorLine::textRepresentation() const | |
42 | { | |
43 | return this->text; | |
44 | } | |
45 | ||
46 | QBrush modelobjects::ErrorLine::textRepresentationForeground() const | |
47 | { | |
48 | return QBrush{Qt::yellow}; | |
49 | } | |
50 | ||
51 | QBrush modelobjects::ErrorLine::textRepresentationBackground() const | |
52 | { | |
53 | return QBrush{Qt::red}; | |
54 | } |