68 connect(ui->actionSettingsEditor, &QAction::triggered, this, &MainWindow::runSettingsEditor); |
68 connect(ui->actionSettingsEditor, &QAction::triggered, this, &MainWindow::runSettingsEditor); |
69 connect(ui->actionAdjustGridToView, &QAction::triggered, [&]() |
69 connect(ui->actionAdjustGridToView, &QAction::triggered, [&]() |
70 { |
70 { |
71 if (this->currentDocument() != nullptr) |
71 if (this->currentDocument() != nullptr) |
72 { |
72 { |
73 this->currentDocument()->adjustGridToView(); |
73 adjustGridToView(this->currentDocument()->canvas); |
74 } |
74 } |
75 }); |
75 }); |
76 connect(this->ui->actionSave, &QAction::triggered, |
76 connect(this->ui->actionSave, &QAction::triggered, |
77 this, &MainWindow::actionSave); |
77 this, &MainWindow::actionSave); |
78 connect(this->ui->actionSaveAs, &QAction::triggered, |
78 connect(this->ui->actionSaveAs, &QAction::triggered, |
192 } |
192 } |
193 |
193 |
194 void MainWindow::openModelForEditing(const ModelId modelId) |
194 void MainWindow::openModelForEditing(const ModelId modelId) |
195 { |
195 { |
196 Document* document = new Document{this->documents.getModelById(modelId), &this->documents, this->colorTable}; |
196 Document* document = new Document{this->documents.getModelById(modelId), &this->documents, this->colorTable}; |
197 document->setRenderPreferences(this->renderPreferences); |
197 document->canvas->setRenderPreferences(this->renderPreferences); |
198 connect(document, &Document::newStatusText, [&](const QString& newStatusText) |
198 connect(document, &Document::newStatusText, [&](const QString& newStatusText) |
199 { |
199 { |
200 this->statusBar()->showMessage(newStatusText); |
200 this->statusBar()->showMessage(newStatusText); |
201 }); |
201 }); |
202 const QFileInfo fileInfo{*this->documents.modelPath(modelId)}; |
202 const QFileInfo fileInfo{*this->documents.modelPath(modelId)}; |
493 for (int i = 0; i < this->ui->tabs->count(); i += 1) |
493 for (int i = 0; i < this->ui->tabs->count(); i += 1) |
494 { |
494 { |
495 Document* document = qobject_cast<Document*>(this->ui->tabs->widget(i)); |
495 Document* document = qobject_cast<Document*>(this->ui->tabs->widget(i)); |
496 if (document != nullptr) |
496 if (document != nullptr) |
497 { |
497 { |
498 document->setRenderPreferences(this->renderPreferences); |
498 document->canvas->setRenderPreferences(this->renderPreferences); |
499 } |
499 } |
500 } |
500 } |
501 for (auto data : ::renderStyleButtons) |
501 for (auto data : ::renderStyleButtons) |
502 { |
502 { |
503 QAction* action = data.memberInstance(this->ui.get()); |
503 QAction* action = data.memberInstance(this->ui.get()); |
557 { |
557 { |
558 QTextStream errors; |
558 QTextStream errors; |
559 this->colorTable = this->libraries.loadColorTable(errors); |
559 this->colorTable = this->libraries.loadColorTable(errors); |
560 } |
560 } |
561 |
561 |
562 void MainWindow::keyReleaseEvent(QKeyEvent* event) |
562 void MainWindow::keyReleaseEvent(QKeyEvent* /*event*/) |
563 { |
563 { |
|
564 /* |
564 Document* document = this->currentDocument(); |
565 Document* document = this->currentDocument(); |
565 if (document != nullptr) |
566 if (document != nullptr) |
566 { |
567 { |
567 document->handleKeyPress(event); |
568 document->handleKeyPress(event); |
568 } |
569 } |
569 } |
570 */ |
|
571 } |