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.
This commit is contained in:
Martin Kleusberg
2014-06-14 13:51:12 +02:00
parent 651e3bf146
commit 2136813bd6
2 changed files with 11 additions and 0 deletions

View File

@@ -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);

View File

@@ -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>
@@ -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>