From 0c30659b6a925fadaaf765f4690414fe312ff4b5 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Sat, 11 Nov 2017 19:24:24 +0100 Subject: [PATCH] Apply find bar visibility to all SQL tabs If multiple SQL tabs are opened, show or hide the find bar for all of them when changing the check state of the button. Also apply the find bar state to newly opened SQL tabs. This also fixes a crash which would happen if you click the Find button prior to opening any SQL tabs, i.e. before opening the first database file. --- src/MainWindow.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 8b242b74..52ad3bd5 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1716,6 +1716,7 @@ unsigned int MainWindow::openSqlTab(bool resetCounter) SqlExecutionArea* w = new SqlExecutionArea(db, this); int index = ui->tabSqlAreas->addTab(w, QString("SQL %1").arg(++tabNumber)); ui->tabSqlAreas->setCurrentIndex(index); + w->setFindFrameVisibility(ui->actionSqlFind->isChecked()); w->getEditor()->setFocus(); return index; @@ -2637,6 +2638,6 @@ void MainWindow::renameSqlTab(int index) void MainWindow::setFindFrameVisibility(bool show) { - qobject_cast(ui->tabSqlAreas->currentWidget())->setFindFrameVisibility(show); - + for(int i=0;itabSqlAreas->count();i++) + qobject_cast(ui->tabSqlAreas->widget(i))->setFindFrameVisibility(show); }