Use Ctrl+W to close a tab in SQL editor and Ctrl+F4 to close DB file

See enhancement #2025
This commit is contained in:
mgrojo
2019-10-30 20:49:02 +01:00
parent ebb5e3b111
commit 24d4ca729b
2 changed files with 8 additions and 1 deletions

View File

@@ -215,6 +215,12 @@ void MainWindow::init()
QShortcut* shortcutPrint = new QShortcut(QKeySequence(QKeySequence::Print), ui->dbTreeWidget, nullptr, nullptr, Qt::WidgetShortcut);
connect(shortcutPrint, &QShortcut::activated, this, &MainWindow::printDbStructure);
QShortcut* closeTabShortcut = new QShortcut(tr("Ctrl+W"), ui->tabSqlAreas, nullptr, nullptr, Qt::WidgetWithChildrenShortcut);
connect(closeTabShortcut, &QShortcut::activated, this, [this]() {
if(ui->tabSqlAreas->currentIndex() > 0)
closeSqlTab(ui->tabSqlAreas->currentIndex());
});
// Create the actions for the recently opened dbs list
for(int i = 0; i < MaxRecentFiles; ++i) {
recentFileActs[i] = new QAction(this);
@@ -3267,6 +3273,7 @@ void MainWindow::showContextMenuSqlTabBar(const QPoint& pos)
QAction* actionClose = new QAction(this);
actionClose->setText(tr("Close Tab"));
actionClose->setShortcut(tr("Ctrl+W"));
connect(actionClose, &QAction::triggered, [this, tab]() {
closeSqlTab(tab);
});

View File

@@ -1187,7 +1187,7 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed
<string>This button closes the connection to the currently open database file</string>
</property>
<property name="shortcut">
<string>Ctrl+W</string>
<string>Ctrl+F4</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>