Skip to content

Commit

Permalink
Allow opening a different project
Browse files Browse the repository at this point in the history
Opening a new project closes and replaces the current project.
  • Loading branch information
Cuperino committed Feb 6, 2025
1 parent 95ba0b5 commit 8ae1839
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()
Expand Down

0 comments on commit 8ae1839

Please sign in to comment.