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);
}

View File

@@ -285,6 +285,7 @@ private slots:
void hideColumns(int column = -1, bool hide = true);
void on_actionShowAllColumns_triggered();
void requestCollation(const QString& name, int eTextRep);
void renameSqlTab(int index);
};
#endif

View File

@@ -2937,6 +2937,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>tabSqlAreas</sender>
<signal>tabBarDoubleClicked(int)</signal>
<receiver>MainWindow</receiver>
<slot>renameSqlTab(int)</slot>
<hints>
<hint type="sourcelabel">
<x>330</x>
<y>372</y>
</hint>
<hint type="destinationlabel">
<x>518</x>
<y>314</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>fileOpen()</slot>
@@ -3005,5 +3021,6 @@
<slot>saveSqlResultsAsView()</slot>
<slot>changeSqlTab(int)</slot>
<slot>hideColumns()</slot>
<slot>renameSqlTab(int)</slot>
</slots>
</ui>