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.
This commit is contained in:
Martin Kleusberg
2017-11-11 19:24:24 +01:00
parent bbc1954f16
commit 0c30659b6a

View File

@@ -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<SqlExecutionArea*>(ui->tabSqlAreas->currentWidget())->setFindFrameVisibility(show);
for(int i=0;i<ui->tabSqlAreas->count();i++)
qobject_cast<SqlExecutionArea*>(ui->tabSqlAreas->widget(i))->setFindFrameVisibility(show);
}