diff -r 40e2940605a3 -r 4bec0525ef1b src/linetypes/object.cpp --- a/src/linetypes/object.cpp Wed Mar 18 17:11:23 2020 +0200 +++ b/src/linetypes/object.cpp Thu Mar 19 21:06:06 2020 +0200 @@ -29,12 +29,20 @@ return {}; } -auto ldraw::Object::setProperty(Property id, const QVariant& value) - -> SetPropertyResult +void ldraw::Object::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) { - Q_UNUSED(id) - Q_UNUSED(value) - return SetPropertyResult::PropertyNotHandled; + Q_UNUSED(result) + Q_UNUSED(pair) +} + +/** + * @brief public interface to setProperty + */ +ldraw::Object::SetPropertyResult ldraw::Object::setProperty(const PropertyKeyValue& pair) +{ + SetPropertyResult result; + this->setProperty(&result, pair); + return result; } QBrush ldraw::Object::textRepresentationForeground() const @@ -60,6 +68,7 @@ const glm::vec3& ldraw::Object::getPoint(int index) const { + Q_UNUSED(index); throw BadPointIndex{}; } @@ -84,28 +93,10 @@ } } -auto ldraw::ColoredObject::setProperty(Property id, const QVariant& value) - -> SetPropertyResult +void ldraw::ColoredObject::setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) { - switch (id) - { - case Property::Color: - { - bool ok; - const int value_int = value.toInt(&ok); - if (ok) - { - colorIndex.index = value_int; - return SetPropertyResult::Success; - } - else - { - return SetPropertyResult::InvalidValue; - } - } - default: - return Object::setProperty(id, value); - } + LDRAW_OBJECT_HANDLE_SET_PROPERTY(Color, {colorIndex.index = value;}); + Object::setProperty(result, pair); } QString ldraw::Empty::textRepresentation() const