src/mainwindow.cpp

changeset 124
f9f308c8e0c5
parent 121
000781318c36
child 125
f127982d3412
--- a/src/mainwindow.cpp	Fri Aug 27 14:38:56 2021 +0300
+++ b/src/mainwindow.cpp	Sun Aug 29 20:05:24 2021 +0300
@@ -214,6 +214,7 @@
 	connect(document, &Document::splitterChanged, this, &MainWindow::handleDocumentSplitterChange);
 	connect(document, &Document::mouseClick, this, &MainWindow::canvasMouseReleased);
 	connect(document, &Document::mouseMove, this, &MainWindow::canvasMouseMoved);
+	connect(document, &Document::keyReleased, this, &MainWindow::canvasKeyReleased);
 	document->setCanvasOverpaintCallback([&](Canvas* canvas, QPainter* painter)
 	{
 		if (this->selectedTool != nullptr)
@@ -445,7 +446,20 @@
 	}
 }
 
-void MainWindow::canvasKeyReleased(QKeyEvent* event)
+void MainWindow::keyReleaseEvent(QKeyEvent *event)
 {
-	Q_UNUSED(event)
+	if (this->selectedTool != nullptr)
+	{
+		this->selectedTool->keyReleased(event);
+	}
 }
+
+void MainWindow::canvasKeyReleased(Document *document, Canvas *canvas, QKeyEvent *event)
+{
+#if 0
+	if (this->selectedTool != nullptr)
+	{
+		this->selectedTool->keyReleased(document, canvas, event);
+	}
+#endif
+}

mercurial