fix that connection are only closed when the window is closed not when the tab owning them is closed.
Caused by the fact the the tab was not freed. Now the widgets on the tabs are freed when they are closed which in turns frees (and closes) the connection objects.
This commit is contained in:
parent
683853e72e
commit
144321a5d3
2 changed files with 6 additions and 2 deletions
|
|
@ -28,7 +28,7 @@ CrudTab::CrudTab(IDatabaseWindow *context, QWidget *parent)
|
||||||
auto delegate = new PgLabItemDelegate(ui->tableView);
|
auto delegate = new PgLabItemDelegate(ui->tableView);
|
||||||
ui->tableView->setItemDelegate(delegate);
|
ui->tableView->setItemDelegate(delegate);
|
||||||
|
|
||||||
m_crudModel = new CrudModel(parent);
|
m_crudModel = new CrudModel(nullptr);
|
||||||
|
|
||||||
m_SortFilterProxy = new QSortFilterProxyModel(this);
|
m_SortFilterProxy = new QSortFilterProxyModel(this);
|
||||||
m_SortFilterProxy->setSourceModel(m_crudModel);
|
m_SortFilterProxy->setSourceModel(m_crudModel);
|
||||||
|
|
@ -48,6 +48,7 @@ CrudTab::CrudTab(IDatabaseWindow *context, QWidget *parent)
|
||||||
|
|
||||||
CrudTab::~CrudTab()
|
CrudTab::~CrudTab()
|
||||||
{
|
{
|
||||||
|
delete m_crudModel;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -281,8 +281,11 @@ void DatabaseWindow::closeTab(int index)
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (canCloseTab(index))
|
if (canCloseTab(index)) {
|
||||||
|
QWidget *widget = m_tabWidget->widget(index);
|
||||||
m_tabWidget->removeTab(index);
|
m_tabWidget->removeTab(index);
|
||||||
|
delete widget;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseWindow::canCloseTab(int index) const
|
bool DatabaseWindow::canCloseTab(int index) const
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue