14 Star 44 Fork 8

zjzdy/Offline-small-search

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
backbuttonhandler.cpp 733 Bytes
一键复制 编辑 原始数据 按行查看 历史
zjzdy 提交于 2018-09-25 00:21 . Fix WebView Back Key bug.
#include "backbuttonhandler.h"
#include <QKeyEvent>
#include <QCoreApplication>
BackButtonHandler::BackButtonHandler(Offline_small_search *parent): QObject(parent), oss(parent)
{
qApp->installEventFilter(this);
}
bool BackButtonHandler::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Back)
{
if(oss != nullptr && oss->tabView_obj != nullptr && watched != oss->tabView_obj)
{
QCoreApplication::postEvent(oss->tabView_obj, new QKeyEvent(*keyEvent));
return true;
}
}
}
return false;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/zjzdy/Offline-small-search.git
git@gitee.com:zjzdy/Offline-small-search.git
zjzdy
Offline-small-search
Offline-small-search
master

搜索帮助