src/ui/objecteditor.cpp

changeset 152
03f8e6d42e13
parent 81
62373840e33a
child 177
f69d53c053df
equal deleted inserted replaced
151:e628fc2e0c72 152:03f8e6d42e13
1 #include <QVBoxLayout> 1 #include <QVBoxLayout>
2 #include "objecteditor.h" 2 #include "objecteditor.h"
3 #include "document.h"
3 4
4 ObjectEditor::ObjectEditor(Model* model, const ldraw::id_t id, QWidget *parent) : 5 ObjectEditor::ObjectEditor(Document* document, const ldraw::id_t id) :
5 QWidget{parent}, 6 QWidget{document},
6 model{model} 7 document{document}
7 { 8 {
8 this->setObjectId(id); 9 this->setObjectId(id);
9 this->setLayout(new QVBoxLayout{this}); 10 this->setLayout(new QVBoxLayout{this});
10 } 11 }
11 12
12 void ObjectEditor::setObjectId(const ldraw::id_t id) 13 void ObjectEditor::setObjectId(const ldraw::id_t id)
13 { 14 {
14 this->objectId = id; 15 this->objectId = id;
15 const ldraw::Object* object = this->model->get(id); 16 const ldraw::Object* object = this->document->getModel().get(id);
16 if (object != nullptr and object->numPoints() > 0) 17 if (object != nullptr and object->numPoints() > 0)
17 { 18 {
18 if (not this->polygonEditor.has_value()) 19 if (not this->polygonEditor.has_value())
19 { 20 {
20 this->polygonEditor.emplace(this->model, id); 21 this->polygonEditor.emplace(this->document, id);
21 this->layout()->addWidget(&*this->polygonEditor); 22 this->layout()->addWidget(&*this->polygonEditor);
22 } 23 }
23 else 24 else
24 { 25 {
25 this->polygonEditor->setObjectId(id); 26 this->polygonEditor->setObjectId(id);

mercurial