mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Allow closing the last tab by opening a new clean one
This allows clearing all the SQL tabs and at the same time, avoids leaving an empty SQL tab widget. Related to issue #2025
This commit is contained in:
@@ -1827,10 +1827,6 @@ bool MainWindow::askSaveSqlTab(int index, bool& ignoreUnattachedBuffers)
|
||||
|
||||
void MainWindow::closeSqlTab(int index, bool force)
|
||||
{
|
||||
// Don't close last tab
|
||||
if(ui->tabSqlAreas->count() == 1 && !force)
|
||||
return;
|
||||
|
||||
// Check if we're still executing statements from this tab and stop them before proceeding
|
||||
if(!ui->tabSqlAreas->tabIcon(index).isNull())
|
||||
{
|
||||
@@ -1852,6 +1848,10 @@ void MainWindow::closeSqlTab(int index, bool force)
|
||||
QWidget* w = ui->tabSqlAreas->widget(index);
|
||||
ui->tabSqlAreas->removeTab(index);
|
||||
delete w;
|
||||
|
||||
// Don't let an empty tab widget
|
||||
if(ui->tabSqlAreas->count() == 0 && !force)
|
||||
openSqlTab(true);
|
||||
}
|
||||
|
||||
int MainWindow::openSqlTab(bool resetCounter)
|
||||
|
||||
Reference in New Issue
Block a user