src/main.cpp

changeset 282
f2dc3bbecbfa
parent 281
afed72b544f0
child 284
9266239cf72b
equal deleted inserted replaced
281:afed72b544f0 282:f2dc3bbecbfa
564 } 564 }
565 }); 565 });
566 QObject::connect(data->canvas.get(), &PartRenderer::message, &messageLog, &MessageLog::addMessage); 566 QObject::connect(data->canvas.get(), &PartRenderer::message, &messageLog, &MessageLog::addMessage);
567 const QFileInfo fileInfo{*documents.modelPath(modelId)}; 567 const QFileInfo fileInfo{*documents.modelPath(modelId)};
568 ModelSubWindow* subWindow = new ModelSubWindow{modelId, ui.mdiArea}; 568 ModelSubWindow* subWindow = new ModelSubWindow{modelId, ui.mdiArea};
569 subWindow->setMinimumSize({96, 96});
569 subWindow->setWidget(data->canvas.get()); 570 subWindow->setWidget(data->canvas.get());
570 subWindow->setWindowTitle(tabName(fileInfo)); 571 subWindow->setWindowTitle(tabName(fileInfo));
571 subWindow->show(); 572 subWindow->show();
572 } 573 }
573 }; 574 };
584 addRecentlyOpenedFile(path); 585 addRecentlyOpenedFile(path);
585 } 586 }
586 } 587 }
587 }); 588 });
588 QObject::connect(ui.actionSettingsEditor, &QAction::triggered, [&]{ 589 QObject::connect(ui.actionSettingsEditor, &QAction::triggered, [&]{
589 SettingsEditor settingsEditor{defaultKeyboardShortcuts, &mainWindow}; 590 SettingsEditor* settingsEditor = new SettingsEditor{defaultKeyboardShortcuts, &mainWindow};
590 const int result = settingsEditor.exec(); 591 QObject::connect(&settingsChanged, &Signal::triggered, settingsEditor, &SettingsEditor::loadSettings);
591 if (result == QDialog::Accepted) 592 QObject::connect(settingsEditor, &SettingsEditor::settingsChanged, restoreSettings);
592 { 593 auto subwindow = new QMdiSubWindow{ui.mdiArea};
593 restoreSettings(); 594 subwindow->setAttribute(Qt::WA_DeleteOnClose);
594 } 595 subwindow->setWidget(settingsEditor);
596 subwindow->show();
595 }); 597 });
596 QObject::connect(ui.actionQuit, &QAction::triggered, &mainWindow, &QMainWindow::close); 598 QObject::connect(ui.actionQuit, &QAction::triggered, &mainWindow, &QMainWindow::close);
597 #if 0 599 #if 0
598 QObject::connect(ui.actionAdjustGridToView, &QAction::triggered, [&]{ 600 QObject::connect(ui.actionAdjustGridToView, &QAction::triggered, [&]{
599 if (ModelData* data = currentModelData(&ui, &documents)) { 601 if (ModelData* data = currentModelData(&ui, &documents)) {
713 ui.modelListView->setModel(data->model); 715 ui.modelListView->setModel(data->model);
714 ui.modelListView->setSelectionModel(data->itemSelectionModel.get()); 716 ui.modelListView->setSelectionModel(data->itemSelectionModel.get());
715 } 717 }
716 } 718 }
717 } 719 }
720 else {
721 checkEditingModeAction(EditingMode::SelectMode);
722 }
718 updateTitle(); 723 updateTitle();
719 }); 724 });
720 ui.messageLog->setModel(&messageLog); 725 ui.messageLog->setModel(&messageLog);
721 QObject::connect(ui.actionAboutQt, &QAction::triggered, &app, &QApplication::aboutQt); 726 QObject::connect(ui.actionAboutQt, &QAction::triggered, &app, &QApplication::aboutQt);
722 QObject::connect(&documents, &DocumentManager::message, &messageLog, &MessageLog::addMessage); 727 QObject::connect(&documents, &DocumentManager::message, &messageLog, &MessageLog::addMessage);

mercurial