diff -r 40e2940605a3 -r 4bec0525ef1b src/modeleditcontext.cpp --- a/src/modeleditcontext.cpp Wed Mar 18 17:11:23 2020 +0200 +++ b/src/modeleditcontext.cpp Thu Mar 19 21:06:06 2020 +0200 @@ -23,6 +23,15 @@ { } +Model::EditContext::~EditContext() +{ + for (ldraw::id_t id : this->modifiedObjects) + { + const QModelIndex index = this->model().lookup(id); + emit this->model().dataChanged(index, index); + } +} + ldraw::id_t Model::EditContext::append(std::unique_ptr&& object) { const ldraw::id_t id = object->id; @@ -36,15 +45,13 @@ this->model().remove(position); } -void Model::EditContext::setObjectProperty( - ldraw::id_t id, - ldraw::Property property, - const QVariant& value) +void Model::EditContext::setObjectPoint(ldraw::id_t id, int pointId, const glm::vec3& value) { ldraw::Object* object = this->model().objectAt(id); if (object != nullptr) { - object->setProperty(property, value); + object->setProperty(ldraw::PropertyKeyValue{ldraw::pointProperty(pointId), QVariant::fromValue(value)}); + modifiedObjects.insert(id); } }