# HG changeset patch # User Teemu Piippo # Date 1621194060 -10800 # Node ID 94719518e31015be3f6579dcae36a95ee5c9f327 # Parent 9108902926391f7c29bb891a07ca34e3df632c7a update diff -r 910890292639 -r 94719518e310 src/mainwindow.cpp --- a/src/mainwindow.cpp Fri Feb 05 14:23:16 2021 +0200 +++ b/src/mainwindow.cpp Sun May 16 22:41:00 2021 +0300 @@ -405,3 +405,25 @@ } } } + +void MainWindow::canvasMousePressed(QMouseEvent *event) +{ + +} + +void MainWindow::canvasMouseReleased(QMouseEvent *event) +{ + BaseTool::MouseEventData eventData; + eventData.ev = event; + // Qt::KeyboardModifiers keymods; + // bool mouseMoved; + // Qt::MouseButtons releasedButtons; + if (this->selectedTool != nullptr) + { + this->selectedTool->mouseReleased(eventData); + } +} + +void MainWindow::canvasMouseDoubleClicked(QMouseEvent* event){} +void MainWindow::canvasMouseMoved(QMouseEvent*){} +void MainWindow::canvasKeyReleased(QKeyEvent*){} diff -r 910890292639 -r 94719518e310 src/mainwindow.h --- a/src/mainwindow.h Fri Feb 05 14:23:16 2021 +0200 +++ b/src/mainwindow.h Sun May 16 22:41:00 2021 +0300 @@ -73,4 +73,10 @@ void loadColors(); Q_SLOT void toolActionTriggered(); void selectTool(BaseTool* tool); +private slots: + void canvasMousePressed(QMouseEvent* event); + void canvasMouseReleased(QMouseEvent* event); + void canvasMouseDoubleClicked(QMouseEvent* event); + void canvasMouseMoved(QMouseEvent*); + void canvasKeyReleased(QKeyEvent*); }; diff -r 910890292639 -r 94719518e310 src/tools/basetool.h --- a/src/tools/basetool.h Fri Feb 05 14:23:16 2021 +0200 +++ b/src/tools/basetool.h Sun May 16 22:41:00 2021 +0300 @@ -25,3 +25,4 @@ virtual bool mouseMoved(QMouseEvent*) { return false; } virtual bool keyReleased(QKeyEvent*) { return false; } }; + diff -r 910890292639 -r 94719518e310 src/tools/drawtool.cpp --- a/src/tools/drawtool.cpp Fri Feb 05 14:23:16 2021 +0200 +++ b/src/tools/drawtool.cpp Sun May 16 22:41:00 2021 +0300 @@ -1,3 +1,4 @@ +#include #include "drawtool.h" DrawTool::DrawTool(QObject* parent) : @@ -14,3 +15,8 @@ static const QString result = tr("Draw new elements into the model."); return result; } + +bool DrawTool::mouseReleased(const BaseTool::MouseEventData &event) +{ + QMessageBox::information(nullptr, "hleelo", "it works"); +} diff -r 910890292639 -r 94719518e310 src/tools/drawtool.h --- a/src/tools/drawtool.h Fri Feb 05 14:23:16 2021 +0200 +++ b/src/tools/drawtool.h Sun May 16 22:41:00 2021 +0300 @@ -10,4 +10,5 @@ QString name() const; QString toolTip() const; + bool mouseReleased(MouseEventData const& event) override; }; diff -r 910890292639 -r 94719518e310 src/ui/canvas.cpp --- a/src/ui/canvas.cpp Fri Feb 05 14:23:16 2021 +0200 +++ b/src/ui/canvas.cpp Sun May 16 22:41:00 2021 +0300 @@ -68,21 +68,15 @@ const float angle_y = std::abs(glm::dot(vector_y, cameraDirection)); if (angle_x < angle_y) { - this->newStatusText("rotate by X axis"); this->gridMatrix = glm::rotate(this->gridMatrix, PI / 2, glm::vec3{1, 0, 0}); } else { - this->newStatusText("rotate by Y axis"); this->gridMatrix = glm::rotate(this->gridMatrix, PI / 2, glm::vec3{0, 1, 0}); } this->updateGridMatrix(); this->update(); } - else - { - this->newStatusText("don't rotate"); - } PartRenderer::mouseMoveEvent(event); }