diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 740a7e3..fac4544 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -330,6 +330,16 @@ bool MainWindow::nativeEvent(const QByteArray &eventType, void *message, long *r return false; } +void MainWindow::keyPressEvent(QKeyEvent *event) +{ + if (event->key() == Qt::Key_Escape) { + this->hide(); + m_search_result_thread->requestInterruption(); + m_search_result_thread->quit(); + } + return QWidget::keyPressEvent(event); +} + void MainWindow::paintEvent(QPaintEvent *event) { Q_UNUSED(event) @@ -345,6 +355,6 @@ void MainWindow::paintEvent(QPaintEvent *event) { p.setOpacity(trans); p.setPen(Qt::NoPen); p.drawRoundedRect(rect, 6, 6); - QWidget::paintEvent(event); + return QWidget::paintEvent(event); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 40d34bb..a1cafd5 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include "content-widget.h" @@ -94,6 +95,7 @@ private: protected: void paintEvent(QPaintEvent *); + void keyPressEvent(QKeyEvent *event); void initUi(); public Q_SLOTS: diff --git a/translations/ukui-search/bo.ts b/translations/ukui-search/bo.ts index f053037..59eb3ab 100644 --- a/translations/ukui-search/bo.ts +++ b/translations/ukui-search/bo.ts @@ -19,37 +19,37 @@ - + Apps - + Settings - + Files - + Dirs - + File Contents - + Best Matches - + Unknown @@ -65,12 +65,12 @@ MainWindow - + Global Search - + Search @@ -106,7 +106,7 @@ QObject - + ukui-search is already running! @@ -122,12 +122,12 @@ SearchDetailView - + Path - + Last time modified diff --git a/translations/ukui-search/tr.ts b/translations/ukui-search/tr.ts index f053037..59eb3ab 100644 --- a/translations/ukui-search/tr.ts +++ b/translations/ukui-search/tr.ts @@ -19,37 +19,37 @@ - + Apps - + Settings - + Files - + Dirs - + File Contents - + Best Matches - + Unknown @@ -65,12 +65,12 @@ MainWindow - + Global Search - + Search @@ -106,7 +106,7 @@ QObject - + ukui-search is already running! @@ -122,12 +122,12 @@ SearchDetailView - + Path - + Last time modified diff --git a/translations/ukui-search/zh_CN.ts b/translations/ukui-search/zh_CN.ts index 5467d46..e5d0d35 100644 --- a/translations/ukui-search/zh_CN.ts +++ b/translations/ukui-search/zh_CN.ts @@ -19,37 +19,37 @@ 常用 - + Apps 应用 - + Settings 配置项 - + Files 文件 - + Dirs 文件夹 - + File Contents 文件内容 - + Best Matches 最佳匹配 - + Unknown 未知 @@ -65,14 +65,14 @@ MainWindow - + Global Search 搜索 - + Search - 从列表搜索 + 搜索 @@ -106,7 +106,7 @@ QObject - + ukui-search is already running! @@ -122,12 +122,12 @@ SearchDetailView - + Path 路径 - + Last time modified 上次修改时间