Skip to content

Commit

Permalink
Make Ctrl+T shortcut to work for "Open tab" in "Execute SQL"
Browse files Browse the repository at this point in the history
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 sqlitebrowser#1647
  • Loading branch information
mgrojo committed Dec 28, 2018
1 parent 0ffed5e commit 8f59d3a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions src/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1684,9 +1684,6 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed
<property name="whatsThis">
<string>Shows or hides the Database toolbar.</string>
</property>
<property name="shortcut">
<string>Ctrl+T</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
Expand Down
4 changes: 4 additions & 0 deletions src/sqltextedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 8f59d3a

Please sign in to comment.