212 this->ui->tabs->setCurrentWidget(document); |
212 this->ui->tabs->setCurrentWidget(document); |
213 document->restoreSplitterState(this->documentSplitterState); |
213 document->restoreSplitterState(this->documentSplitterState); |
214 connect(document, &Document::splitterChanged, this, &MainWindow::handleDocumentSplitterChange); |
214 connect(document, &Document::splitterChanged, this, &MainWindow::handleDocumentSplitterChange); |
215 connect(document, &Document::mouseClick, this, &MainWindow::canvasMouseReleased); |
215 connect(document, &Document::mouseClick, this, &MainWindow::canvasMouseReleased); |
216 connect(document, &Document::mouseMove, this, &MainWindow::canvasMouseMoved); |
216 connect(document, &Document::mouseMove, this, &MainWindow::canvasMouseMoved); |
|
217 connect(document, &Document::keyReleased, this, &MainWindow::canvasKeyReleased); |
217 document->setCanvasOverpaintCallback([&](Canvas* canvas, QPainter* painter) |
218 document->setCanvasOverpaintCallback([&](Canvas* canvas, QPainter* painter) |
218 { |
219 { |
219 if (this->selectedTool != nullptr) |
220 if (this->selectedTool != nullptr) |
220 { |
221 { |
221 this->selectedTool->overpaint(canvas, painter); |
222 this->selectedTool->overpaint(canvas, painter); |
443 { |
444 { |
444 this->selectedTool->mouseMove(document, canvas, event); |
445 this->selectedTool->mouseMove(document, canvas, event); |
445 } |
446 } |
446 } |
447 } |
447 |
448 |
448 void MainWindow::canvasKeyReleased(QKeyEvent* event) |
449 void MainWindow::keyReleaseEvent(QKeyEvent *event) |
449 { |
450 { |
450 Q_UNUSED(event) |
451 if (this->selectedTool != nullptr) |
451 } |
452 { |
|
453 this->selectedTool->keyReleased(event); |
|
454 } |
|
455 } |
|
456 |
|
457 void MainWindow::canvasKeyReleased(Document *document, Canvas *canvas, QKeyEvent *event) |
|
458 { |
|
459 #if 0 |
|
460 if (this->selectedTool != nullptr) |
|
461 { |
|
462 this->selectedTool->keyReleased(document, canvas, event); |
|
463 } |
|
464 #endif |
|
465 } |