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>
This commit is contained in:
liuxing 2020-09-08 10:50:41 +08:00
parent 48b5458eec
commit f6ab9d8846
2 changed files with 7 additions and 4 deletions

View File

@ -2,6 +2,7 @@
#include "constants.h"
#include <QMouseEvent>
#include <QTouchEvent>
DockApplication::DockApplication(int &argc, char **argv) : DApplication (argc, argv)
{
@ -15,5 +16,11 @@ bool DockApplication::notify(QObject *obj, QEvent *event)
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);
}

View File

@ -41,10 +41,6 @@ class DockApplication : public DApplication
public:
explicit DockApplication(int &argc, char **argv);
virtual bool notify(QObject *obj, QEvent *event) override;
signals:
public slots:
};
#endif // DOCKAPPLICATION_H