27 { |
27 { |
28 Q_UNUSED(id); |
28 Q_UNUSED(id); |
29 return {}; |
29 return {}; |
30 } |
30 } |
31 |
31 |
32 auto ldraw::Object::setProperty(Property id, const QVariant& value) |
32 void ldraw::Object::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) |
33 -> SetPropertyResult |
|
34 { |
33 { |
35 Q_UNUSED(id) |
34 Q_UNUSED(result) |
36 Q_UNUSED(value) |
35 Q_UNUSED(pair) |
37 return SetPropertyResult::PropertyNotHandled; |
36 } |
|
37 |
|
38 /** |
|
39 * @brief public interface to setProperty |
|
40 */ |
|
41 ldraw::Object::SetPropertyResult ldraw::Object::setProperty(const PropertyKeyValue& pair) |
|
42 { |
|
43 SetPropertyResult result; |
|
44 this->setProperty(&result, pair); |
|
45 return result; |
38 } |
46 } |
39 |
47 |
40 QBrush ldraw::Object::textRepresentationForeground() const |
48 QBrush ldraw::Object::textRepresentationForeground() const |
41 { |
49 { |
42 return {}; |
50 return {}; |
82 default: |
91 default: |
83 return Object::getProperty(id); |
92 return Object::getProperty(id); |
84 } |
93 } |
85 } |
94 } |
86 |
95 |
87 auto ldraw::ColoredObject::setProperty(Property id, const QVariant& value) |
96 void ldraw::ColoredObject::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) |
88 -> SetPropertyResult |
|
89 { |
97 { |
90 switch (id) |
98 LDRAW_OBJECT_HANDLE_SET_PROPERTY(Color, {colorIndex.index = value;}); |
91 { |
99 Object::setProperty(result, pair); |
92 case Property::Color: |
|
93 { |
|
94 bool ok; |
|
95 const int value_int = value.toInt(&ok); |
|
96 if (ok) |
|
97 { |
|
98 colorIndex.index = value_int; |
|
99 return SetPropertyResult::Success; |
|
100 } |
|
101 else |
|
102 { |
|
103 return SetPropertyResult::InvalidValue; |
|
104 } |
|
105 } |
|
106 default: |
|
107 return Object::setProperty(id, value); |
|
108 } |
|
109 } |
100 } |
110 |
101 |
111 QString ldraw::Empty::textRepresentation() const |
102 QString ldraw::Empty::textRepresentation() const |
112 { |
103 { |
113 return ""; |
104 return ""; |