From 9e6bd05f359b88e88df42b11963a3382a276e5e8 Mon Sep 17 00:00:00 2001 From: mgrojo Date: Fri, 5 Apr 2019 20:54:09 +0200 Subject: [PATCH] Avoid ambiguity for Ctrl+F in the Execute SQL tab When the Ctrl+F was used in the Scintilla widgets of the SQL Log or Edit Database Cell docks, the shortcut was ambiguous with the search find bar action, which had window context. Now the later has widget context and a new widget-context shortcut is explicitly connected to the action in the editors of each new SQL tab. See issue #1746 --- src/MainWindow.cpp | 4 ++++ src/MainWindow.ui | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 09996c05..ad86b3e6 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -2264,6 +2264,10 @@ int MainWindow::openSqlTab(bool resetCounter) w->getEditor()->setFocus(); connect(w, SIGNAL(findFrameVisibilityChanged(bool)), ui->actionSqlFind, SLOT(setChecked(bool))); + // Connect now the find shortcut to the editor with widget context, so it isn't ambiguous with other Scintilla Widgets. + QShortcut* shortcutFind = new QShortcut(ui->actionSqlFind->shortcut(), w->getEditor(), nullptr, nullptr, Qt::WidgetShortcut); + connect(shortcutFind, SIGNAL(activated()), ui->actionSqlFind, SLOT(toggle())); + return index; } diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 07de2ffc..7d969440 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -2115,6 +2115,9 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Ctrl+F + + Qt::WidgetShortcut +