--- a/src/document.cpp Sun Jul 25 16:29:08 2021 +0300 +++ b/src/document.cpp Sun Jul 25 20:29:14 2021 +0300 @@ -20,6 +20,7 @@ #include "document.h" #include "ui_document.h" #include "model.h" +#include "modeleditcontext.h" Document::Document( Model* model, @@ -71,8 +72,14 @@ this->selectionChanged(resolve(this->ui.listView->selectionModel()->selection())); }); connect(this->model, &Model::dataChanged, this->renderer, qOverload<>(&Canvas::update)); - connect(this->renderer, &Canvas::mouseClick, this, &Document::mouseClick); - connect(this->renderer, &Canvas::mouseMove, this, &Document::mouseMove); + connect(this->renderer, &Canvas::mouseClick, this, [this](Canvas* canvas) + { + Q_EMIT this->mouseClick(this, canvas); + }); + connect(this->renderer, &Canvas::mouseMove, this, [this](Canvas* canvas) + { + Q_EMIT this->mouseMove(this, canvas); + }); } Document::~Document() @@ -100,6 +107,11 @@ this->renderer->setOverpaintCallback(fn); } +Model::EditContext Document::editModel() +{ + return this->model->edit(); +} + void Document::selectionChanged(const QSet<ldraw::id_t>& newSelection) { if (newSelection.size() == 1)