dde-dock/frame/util/dockapplication.cpp
liuxing f6ab9d8846 fix: 任务栏没有屏蔽多指功能
通过重写application的notify函数,拦截触屏事件,判断触屏点个数,触点个数大于1时屏蔽事件处理

Log: 屏蔽任务栏默认的多指功能
Bug: https://pms.uniontech.com/zentao/bug-view-46287.html
Change-Id: Ic0fa6187be283d2e8149dc74d4c7ca642ece9a4e
Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/4051
Reviewed-by: <mailman@uniontech.com>
Reviewed-by: wangwei <wangwei@uniontech.com>
Reviewed-by: fanpengcheng <fanpengcheng@uniontech.com>
Tested-by: <mailman@uniontech.com>
2020-09-09 16:45:16 +08:00

27 lines
799 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "dockapplication.h"
#include "constants.h"
#include <QMouseEvent>
#include <QTouchEvent>
DockApplication::DockApplication(int &argc, char **argv) : DApplication (argc, argv)
{
}
bool DockApplication::notify(QObject *obj, QEvent *event)
{
QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent *>(event);
if (mouseEvent) {
// 鼠标事件可以通过source函数确定是否触屏事件并将结果写入qApp的动态属性中
qApp->setProperty(IS_TOUCH_STATE, (mouseEvent->source() == Qt::MouseEventSynthesizedByQt));
}
// 任务栏屏蔽多指触控
QTouchEvent *touchEvent = dynamic_cast<QTouchEvent *>(event);
if(touchEvent && (touchEvent->touchPoints().size() > 1)) {
return true;
}
return DApplication::notify(obj, event);
}