Skip to content

Commit 8ae1839

Browse files
committed
Allow opening a different project
Opening a new project closes and replaces the current project.
1 parent 95ba0b5 commit 8ae1839

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/gui/mainwindow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@ void MainWindow::openProject()
364364

365365
void MainWindow::initProject(const QString &path)
366366
{
367+
const int tabCount = ui->tabWidget->tabBar()->count();
368+
for (int i = tabCount; i >= 0; i--)
369+
closeDocument(i);
370+
367371
setWindowTitle(generateWindowTitle(path));
368372
// Update recent list
369373
QSettings settings;
@@ -378,10 +382,6 @@ void MainWindow::initProject(const QString &path)
378382
auto index = m_fileModel->setRootPath(path);
379383
m_projectView->setRootIndex(index);
380384
connect(m_projectView->selectionModel(), &QItemSelectionModel::currentChanged, this, &MainWindow::openDocument);
381-
382-
// Disable menus, we can only load one project - restart Knut if needed
383-
ui->actionOpen->setEnabled(false);
384-
ui->actionRecentProjects->setEnabled(false);
385385
}
386386

387387
void MainWindow::updateRecentProjects()

0 commit comments

Comments
 (0)