Skip to content

Commit 2136813

Browse files
committed
MainWindow: Add Ctrl+Return shortcut for executing SQL and add tooltips
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.
1 parent 651e3bf commit 2136813

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/MainWindow.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ void MainWindow::init()
7979
ui->dbTreeWidget->setColumnHidden(1, true);
8080
ui->dbTreeWidget->setColumnWidth(0, 300);
8181

82+
// Add keyboard shortcuts
83+
QList<QKeySequence> shortcuts = ui->actionExecuteSql->shortcuts();
84+
shortcuts.push_back(QKeySequence(tr("Ctrl+Return")));
85+
ui->actionExecuteSql->setShortcuts(shortcuts);
86+
8287
// Create the actions for the recently opened dbs list
8388
for(int i = 0; i < MaxRecentFiles; ++i) {
8489
recentFileActs[i] = new QAction(this);

src/MainWindow.ui

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,9 @@
13601360
<property name="text">
13611361
<string>&amp;Execute SQL</string>
13621362
</property>
1363+
<property name="toolTip">
1364+
<string>Execute SQL [F5, Ctrl+Return]</string>
1365+
</property>
13631366
<property name="shortcut">
13641367
<string>F5</string>
13651368
</property>
@@ -1402,6 +1405,9 @@
14021405
<property name="text">
14031406
<string>Execute current line</string>
14041407
</property>
1408+
<property name="toolTip">
1409+
<string>Execute current line [Ctrl+E]</string>
1410+
</property>
14051411
<property name="shortcut">
14061412
<string>Ctrl+E</string>
14071413
</property>

0 commit comments

Comments
 (0)