Do not always refresh the table browser dock when opening a database

It does not seem like there is a good reason to always refresh the table
browser dock (there is always exactly one at this point) when opening a
database file, even when it is not visible. This only generates
unnecessary queries to the database.
This commit is contained in:
Martin Kleusberg
2021-05-22 10:28:49 +02:00
parent f56288023b
commit 3be5969bca
2 changed files with 4 additions and 4 deletions

View File

@@ -566,7 +566,7 @@ bool MainWindow::fileOpen(const QString& fileName, bool openFromProject, bool re
else if(ui->mainTab->currentWidget() == ui->pragmas)
loadPragmas();
refreshTableBrowsers(true);
refreshTableBrowsers();
// Update remote dock
remoteDock->fileOpened(wFile);
@@ -672,14 +672,14 @@ void MainWindow::populateStructure(const std::vector<sqlb::ObjectIdentifier>& ol
ui->treeSchemaDock->resizeColumnToContents(DbStructureModel::ColumnName);
}
void MainWindow::refreshTableBrowsers(bool force_refresh)
void MainWindow::refreshTableBrowsers()
{
QApplication::setOverrideCursor(Qt::WaitCursor);
for(const auto& d : allTableBrowserDocks())
{
// When in the Browse Data tab update all docks. Otherwise just update the floating ones because they might
// be visible even when another tab is active.
if(force_refresh || ui->mainTab->currentWidget() == ui->browser || d->isFloating())
if(ui->mainTab->currentWidget() == ui->browser || d->isFloating())
{
TableBrowser* t = d->tableBrowser();
if(t)

View File

@@ -166,7 +166,7 @@ private slots:
void changeTreeSelection();
void fileNew();
void fileNewInMemoryDatabase(bool open_create_dialog = true);
void refreshTableBrowsers(bool force_refresh = false);
void refreshTableBrowsers();
bool fileClose();
bool fileSaveAs();
void createTable();