From 13db875acd942337ff652e759e2f29f3e627e581 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Sun, 7 Apr 2013 20:55:56 +0200 Subject: [PATCH] Clear the table view in the browse tab when closing a database file --- src/MainWindow.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 9d469dc3..066ba703 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -272,11 +272,20 @@ void MainWindow::populateStructure() void MainWindow::populateTable( const QString & tablename) { + // Remove the model-view link if the table name is empty in order to remove any data from the view + if(tablename.isEmpty()) + { + ui->dataTable->setModel(0); + return; + } + QApplication::setOverrideCursor(Qt::WaitCursor); + // Set model + ui->dataTable->setModel(m_browseTableModel); + // Set new table - if(!tablename.isEmpty()) - m_browseTableModel->setTable(tablename); + m_browseTableModel->setTable(tablename); ui->dataTable->setColumnHidden(0, true); // Reset sorting