forked from openkylin/ukui-search
feat(frontend): Add keypress event.
Description: 添加esc按键监听隐藏主界面 Log: 添加esc按键监听隐藏主界面
This commit is contained in:
parent
db3e947e95
commit
c93292bf4b
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <QLabel>
|
||||
#include <QFrame>
|
||||
#include <QPushButton>
|
||||
#include <QKeyEvent>
|
||||
#include <QGSettings/QGSettings>
|
||||
#include <QSystemTrayIcon>
|
||||
#include "content-widget.h"
|
||||
|
@ -94,6 +95,7 @@ private:
|
|||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
void initUi();
|
||||
|
||||
public Q_SLOTS:
|
||||
|
|
|
@ -19,37 +19,37 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="585"/>
|
||||
<location filename="../../src/content-widget.cpp" line="586"/>
|
||||
<source>Apps</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="587"/>
|
||||
<location filename="../../src/content-widget.cpp" line="588"/>
|
||||
<source>Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="589"/>
|
||||
<location filename="../../src/content-widget.cpp" line="590"/>
|
||||
<source>Files</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="591"/>
|
||||
<location filename="../../src/content-widget.cpp" line="592"/>
|
||||
<source>Dirs</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="593"/>
|
||||
<location filename="../../src/content-widget.cpp" line="594"/>
|
||||
<source>File Contents</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="595"/>
|
||||
<location filename="../../src/content-widget.cpp" line="596"/>
|
||||
<source>Best Matches</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="597"/>
|
||||
<location filename="../../src/content-widget.cpp" line="598"/>
|
||||
<source>Unknown</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -65,12 +65,12 @@
|
|||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../../src/mainwindow.cpp" line="108"/>
|
||||
<location filename="../../src/mainwindow.cpp" line="110"/>
|
||||
<source>Global Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/mainwindow.cpp" line="161"/>
|
||||
<location filename="../../src/mainwindow.cpp" line="163"/>
|
||||
<source>Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -106,7 +106,7 @@
|
|||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../../src/main.cpp" line="104"/>
|
||||
<location filename="../../src/main.cpp" line="106"/>
|
||||
<source>ukui-search is already running!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -122,12 +122,12 @@
|
|||
<context>
|
||||
<name>SearchDetailView</name>
|
||||
<message>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="346"/>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="340"/>
|
||||
<source>Path</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="354"/>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="348"/>
|
||||
<source>Last time modified</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -19,37 +19,37 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="585"/>
|
||||
<location filename="../../src/content-widget.cpp" line="586"/>
|
||||
<source>Apps</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="587"/>
|
||||
<location filename="../../src/content-widget.cpp" line="588"/>
|
||||
<source>Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="589"/>
|
||||
<location filename="../../src/content-widget.cpp" line="590"/>
|
||||
<source>Files</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="591"/>
|
||||
<location filename="../../src/content-widget.cpp" line="592"/>
|
||||
<source>Dirs</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="593"/>
|
||||
<location filename="../../src/content-widget.cpp" line="594"/>
|
||||
<source>File Contents</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="595"/>
|
||||
<location filename="../../src/content-widget.cpp" line="596"/>
|
||||
<source>Best Matches</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="597"/>
|
||||
<location filename="../../src/content-widget.cpp" line="598"/>
|
||||
<source>Unknown</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -65,12 +65,12 @@
|
|||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../../src/mainwindow.cpp" line="108"/>
|
||||
<location filename="../../src/mainwindow.cpp" line="110"/>
|
||||
<source>Global Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/mainwindow.cpp" line="161"/>
|
||||
<location filename="../../src/mainwindow.cpp" line="163"/>
|
||||
<source>Search</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -106,7 +106,7 @@
|
|||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../../src/main.cpp" line="104"/>
|
||||
<location filename="../../src/main.cpp" line="106"/>
|
||||
<source>ukui-search is already running!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
@ -122,12 +122,12 @@
|
|||
<context>
|
||||
<name>SearchDetailView</name>
|
||||
<message>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="346"/>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="340"/>
|
||||
<source>Path</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="354"/>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="348"/>
|
||||
<source>Last time modified</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -19,37 +19,37 @@
|
|||
<translation>常用</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="585"/>
|
||||
<location filename="../../src/content-widget.cpp" line="586"/>
|
||||
<source>Apps</source>
|
||||
<translation>应用</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="587"/>
|
||||
<location filename="../../src/content-widget.cpp" line="588"/>
|
||||
<source>Settings</source>
|
||||
<translation>配置项</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="589"/>
|
||||
<location filename="../../src/content-widget.cpp" line="590"/>
|
||||
<source>Files</source>
|
||||
<translation>文件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="591"/>
|
||||
<location filename="../../src/content-widget.cpp" line="592"/>
|
||||
<source>Dirs</source>
|
||||
<translation>文件夹</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="593"/>
|
||||
<location filename="../../src/content-widget.cpp" line="594"/>
|
||||
<source>File Contents</source>
|
||||
<translation>文件内容</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="595"/>
|
||||
<location filename="../../src/content-widget.cpp" line="596"/>
|
||||
<source>Best Matches</source>
|
||||
<translation>最佳匹配</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/content-widget.cpp" line="597"/>
|
||||
<location filename="../../src/content-widget.cpp" line="598"/>
|
||||
<source>Unknown</source>
|
||||
<translation>未知</translation>
|
||||
</message>
|
||||
|
@ -65,14 +65,14 @@
|
|||
<context>
|
||||
<name>MainWindow</name>
|
||||
<message>
|
||||
<location filename="../../src/mainwindow.cpp" line="108"/>
|
||||
<location filename="../../src/mainwindow.cpp" line="110"/>
|
||||
<source>Global Search</source>
|
||||
<translation type="unfinished">搜索</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/mainwindow.cpp" line="161"/>
|
||||
<location filename="../../src/mainwindow.cpp" line="163"/>
|
||||
<source>Search</source>
|
||||
<translation>从列表搜索</translation>
|
||||
<translation>搜索</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -106,7 +106,7 @@
|
|||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../../src/main.cpp" line="104"/>
|
||||
<location filename="../../src/main.cpp" line="106"/>
|
||||
<source>ukui-search is already running!</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
|
@ -122,12 +122,12 @@
|
|||
<context>
|
||||
<name>SearchDetailView</name>
|
||||
<message>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="346"/>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="340"/>
|
||||
<source>Path</source>
|
||||
<translation>路径</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="354"/>
|
||||
<location filename="../../src/control/search-detail-view.cpp" line="348"/>
|
||||
<source>Last time modified</source>
|
||||
<translation>上次修改时间</translation>
|
||||
</message>
|
||||
|
|
Loading…
Reference in New Issue