Make escape work everywhere

This commit is contained in:
Christoffer Klang 2013-08-11 01:06:43 +02:00
parent c4387ca9b7
commit ae96efc4f4

View File

@ -25,6 +25,7 @@
#include <QFutureWatcher> #include <QFutureWatcher>
#include <QWebFrame> #include <QWebFrame>
#include <QWebElement> #include <QWebElement>
#include <QShortcut>
#include <quazip/quazip.h> #include <quazip/quazip.h>
#include "JlCompress.h" #include "JlCompress.h"
@ -444,6 +445,13 @@ void MainWindow::setupShortcuts()
connect(focusSearch, &QShortcut::activated, [=]() { connect(focusSearch, &QShortcut::activated, [=]() {
ui->lineEdit->setFocus(); ui->lineEdit->setFocus();
}); });
QShortcut* globalEsc = new QShortcut(QKeySequence("Esc"), this);
globalEsc->setContext(Qt::ApplicationShortcut);
connect(globalEsc, &QShortcut::activated, [=]() {
ui->lineEdit->setFocus();
ui->lineEdit->clearQuery();
});
} }
void MainWindow::setHotKey(const QKeySequence& hotKey_) { void MainWindow::setHotKey(const QKeySequence& hotKey_) {