From 8ae1839826e7d9706fc6226e5826f6ccefcff7cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20O=2E=20Cordero=20P=C3=A9rez?= Date: Wed, 5 Feb 2025 21:58:12 -0400 Subject: [PATCH] Allow opening a different project Opening a new project closes and replaces the current project. --- src/gui/mainwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 0681bf9d..5967bb22 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -364,6 +364,10 @@ void MainWindow::openProject() void MainWindow::initProject(const QString &path) { + const int tabCount = ui->tabWidget->tabBar()->count(); + for (int i = tabCount; i >= 0; i--) + closeDocument(i); + setWindowTitle(generateWindowTitle(path)); // Update recent list QSettings settings; @@ -378,10 +382,6 @@ void MainWindow::initProject(const QString &path) auto index = m_fileModel->setRootPath(path); m_projectView->setRootIndex(index); connect(m_projectView->selectionModel(), &QItemSelectionModel::currentChanged, this, &MainWindow::openDocument); - - // Disable menus, we can only load one project - restart Knut if needed - ui->actionOpen->setEnabled(false); - ui->actionRecentProjects->setEnabled(false); } void MainWindow::updateRecentProjects()