From 6ccae6cc37dbe5123c266f768c48fbd23136cdc8 Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Thu, 26 Jan 2017 00:30:16 +0900 Subject: [PATCH] Pressing escape quits search --- src/gui/SearchWidget.cpp | 1 + tests/gui/TestGui.cpp | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/SearchWidget.cpp b/src/gui/SearchWidget.cpp index 4ac01b3fc..933686dfa 100644 --- a/src/gui/SearchWidget.cpp +++ b/src/gui/SearchWidget.cpp @@ -41,6 +41,7 @@ SearchWidget::SearchWidget(QWidget *parent) connect(this, SIGNAL(escapePressed()), m_ui->searchEdit, SLOT(clear())); new QShortcut(Qt::CTRL + Qt::Key_F, this, SLOT(searchFocus()), nullptr, Qt::ApplicationShortcut); + new QShortcut(Qt::Key_Escape, m_ui->searchEdit, SLOT(clear()), nullptr, Qt::ApplicationShortcut); m_ui->searchEdit->installEventFilter(this); diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index c23226a28..7d6677601 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -481,8 +481,7 @@ void TestGui::testSearch() QCOMPARE(entry->title(), origTitle.append("_edited")); // Cancel search, should return to normal view - QTest::mouseClick(searchTextEdit, Qt::LeftButton); - QTest::keyClick(searchTextEdit, Qt::Key_Escape); + QTest::keyClick(m_mainWindow, Qt::Key_Escape); QTRY_COMPARE(m_dbWidget->currentMode(), DatabaseWidget::ViewMode); }