From 8417cc96fd417889a689b70dc4d3346ad96a6b24 Mon Sep 17 00:00:00 2001 From: liuminghang Date: Wed, 29 Sep 2021 15:58:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dbug97212?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: 鼠标释放的时候重置状态 Log: 与编辑区域有关系 Bug: https://pms.uniontech.com/zentao/bug-view-97212.html Change-Id: If3ea5ad764d6d4b18292866258d4c54670a3b97d --- src/resulttextview.cpp | 12 ++++++++++++ src/resulttextview.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/resulttextview.cpp b/src/resulttextview.cpp index 8bbece4..0fe5792 100644 --- a/src/resulttextview.cpp +++ b/src/resulttextview.cpp @@ -162,6 +162,18 @@ void ResultTextView::mousePressEvent(QMouseEvent *e) QPlainTextEdit::mousePressEvent(e); } +void ResultTextView::mouseReleaseEvent(QMouseEvent *e) +{ + //修复一指滑动导致了ocr无法选择任何文本 + if (e->type() == QEvent::MouseButtonRelease && e->source() == Qt::MouseEventSynthesizedByQt) { + qDebug() << "action is over" << m_gestureAction; + + m_gestureAction = GA_null; + } + + return QPlainTextEdit::mouseReleaseEvent(e); +} + bool ResultTextView::event(QEvent *event) { if (event->type() == QEvent::Gesture) diff --git a/src/resulttextview.h b/src/resulttextview.h index ad87955..5d60bcf 100644 --- a/src/resulttextview.h +++ b/src/resulttextview.h @@ -18,7 +18,7 @@ protected: void resizeEvent(QResizeEvent *event) override; void mouseMoveEvent(QMouseEvent *e) override; void mousePressEvent(QMouseEvent *e) override; - + void mouseReleaseEvent(QMouseEvent *e) override; bool event(QEvent *event) override; //触摸屏功能函数 bool gestureEvent(QGestureEvent *event);