From 8f59d3aed647ee4858102650a75e67097d6e29a7 Mon Sep 17 00:00:00 2001 From: mgrojo Date: Fri, 28 Dec 2018 13:04:17 +0100 Subject: [PATCH] Make Ctrl+T shortcut to work for "Open tab" in "Execute SQL" This shortcut was set for the following actions, making it ambiguous: "View > DB Toolbar" and "Open tab" in "Execute SQL". Additionally it was used by QScintilla for transposing lines. Shortcut for "View > DB Toolbar" has been removed, since it's not considered a frequently used action and there are other toolbars without shortcut. The shortcut for QScintilla has been changed to "Ctrl+Shift+Up". The now working shortcut is added to the "Open tab" action's tool-tip for documentation purposes. See issue #1647 --- src/MainWindow.cpp | 1 + src/MainWindow.ui | 3 --- src/sqltextedit.cpp | 4 ++++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index ffbdf34e1..7d3ab40bc 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -512,6 +512,7 @@ void MainWindow::init() addShortcutsTooltip(ui->buttonRefresh, {shortcutBrowseRefreshF5->key(), shortcutBrowseRefreshCtrlR->key()}); addShortcutsTooltip(ui->buttonPrintTable, {shortcutPrint->key()}); + addShortcutsTooltip(ui->actionSqlOpenTab); addShortcutsTooltip(ui->actionSqlPrint); addShortcutsTooltip(ui->actionExecuteSql, {shortcutBrowseRefreshF5->key(), shortcutBrowseRefreshCtrlR->key()}); addShortcutsTooltip(ui->actionSqlExecuteLine); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 483df3ea1..63823424b 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -1684,9 +1684,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Shows or hides the Database toolbar. - - Ctrl+T - QAction::NoRole diff --git a/src/sqltextedit.cpp b/src/sqltextedit.cpp index 5bc978e06..2e00c4edc 100644 --- a/src/sqltextedit.cpp +++ b/src/sqltextedit.cpp @@ -34,6 +34,10 @@ SqlTextEdit::SqlTextEdit(QWidget* parent) : command = standardCommands()->boundTo(Qt::ControlModifier+Qt::ShiftModifier+Qt::Key_Slash); command->setKey(0); + // Change command binding for Ctrl+T so it doesn't interfere with "Open tab" + command = standardCommands()->boundTo(Qt::ControlModifier+Qt::Key_T); + command->setKey(Qt::ControlModifier+Qt::ShiftModifier+Qt::Key_Up); + QShortcut* shortcutToggleComment = new QShortcut(QKeySequence(tr("Ctrl+/")), this, nullptr, nullptr, Qt::WidgetShortcut); connect(shortcutToggleComment, &QShortcut::activated, this, &SqlTextEdit::toggleBlockComment);