Skip to content

Commit

Permalink
MainWindow: Add Ctrl+Return shortcut for executing SQL and add tooltips
Browse files Browse the repository at this point in the history
Add the Ctrl+Return shortcut for executing the current SQL again. This
needs to be done using C++ code instead of setting it in Qt Designer
because setting multiple shortcuts in the latter means defining a key
sequence row.

Also add the keyboard shortcuts to the tooltips of the buttons as they
didn't appear anywhere in the program.
  • Loading branch information
MKleusberg committed Jun 14, 2014
1 parent 651e3bf commit 2136813
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ void MainWindow::init()
ui->dbTreeWidget->setColumnHidden(1, true);
ui->dbTreeWidget->setColumnWidth(0, 300);

// Add keyboard shortcuts
QList<QKeySequence> shortcuts = ui->actionExecuteSql->shortcuts();
shortcuts.push_back(QKeySequence(tr("Ctrl+Return")));
ui->actionExecuteSql->setShortcuts(shortcuts);

// Create the actions for the recently opened dbs list
for(int i = 0; i < MaxRecentFiles; ++i) {
recentFileActs[i] = new QAction(this);
Expand Down
6 changes: 6 additions & 0 deletions src/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,9 @@
<property name="text">
<string>&amp;Execute SQL</string>
</property>
<property name="toolTip">
<string>Execute SQL [F5, Ctrl+Return]</string>
</property>
<property name="shortcut">
<string>F5</string>
</property>
Expand Down Expand Up @@ -1402,6 +1405,9 @@
<property name="text">
<string>Execute current line</string>
</property>
<property name="toolTip">
<string>Execute current line [Ctrl+E]</string>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
</property>
Expand Down

0 comments on commit 2136813

Please sign in to comment.