Allow renaming SQL tabs by double clicking them

See issue #1186.
This commit is contained in:
Martin Kleusberg
2017-10-22 14:08:52 +02:00
parent 5cef432159
commit bc91126b2c
3 changed files with 30 additions and 0 deletions

View File

@@ -2626,3 +2626,15 @@ void MainWindow::requestCollation(const QString& name, int eTextRep)
if(reply == QMessageBox::Yes)
sqlite3_create_collation(db._db, name.toUtf8(), eTextRep, nullptr, collCompare);
}
void MainWindow::renameSqlTab(int index)
{
QString new_name = QInputDialog::getText(this,
qApp->applicationName(),
tr("Set a new name for the SQL tab. Use the '&' character to allow using the following character as a keyboard shortcut."),
QLineEdit::EchoMode::Normal,
ui->tabSqlAreas->tabText(index));
if(!new_name.isNull()) // Don't do anything if the Cancel button was clicked
ui->tabSqlAreas->setTabText(index, new_name);
}