update

Sun, 16 May 2021 22:41:00 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 16 May 2021 22:41:00 +0300
changeset 103
94719518e310
parent 101
910890292639
child 104
cd4df75924b7

update

src/mainwindow.cpp file | annotate | diff | comparison | revisions
src/mainwindow.h file | annotate | diff | comparison | revisions
src/tools/basetool.h file | annotate | diff | comparison | revisions
src/tools/drawtool.cpp file | annotate | diff | comparison | revisions
src/tools/drawtool.h file | annotate | diff | comparison | revisions
src/ui/canvas.cpp file | annotate | diff | comparison | revisions
--- 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*){}
--- 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*);
 };
--- 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; }
 };
+
--- 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 <QMessageBox>
 #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");
+}
--- 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;
 };
--- 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<float> / 2, glm::vec3{1, 0, 0});
 		}
 		else
 		{
-			this->newStatusText("rotate by Y axis");
 			this->gridMatrix = glm::rotate(this->gridMatrix, PI<float> / 2, glm::vec3{0, 1, 0});
 		}
 		this->updateGridMatrix();
 		this->update();
 	}
-	else
-	{
-		this->newStatusText("don't rotate");
-	}
 	PartRenderer::mouseMoveEvent(event);
 }
 

mercurial