Unable to get touch events on QGraphicsView using single touch in Qt5.12.4
Unsolved
General and Desktop
-
Hi,
I create a sample application to get touch events from QGraphicsView using viewport events.
If I build this application with Qt5.6 then it is working and I can get Touch Begin, Touch Update and Touch End events. But when I compile it with Qt5.12.4, my application is not able to get Touch Update and Touch End events. It only gets Touch Begin.
This problem is only with single touch. If I use multi touch, then it works fine.
I share my sample application code.
#include "GraphicsView.h" #include <QDebug> CGraphicsView::CGraphicsView(Widget* wid) { this->setParent(wid); this->setGeometry(wid->geometry()); viewport()->setAttribute(Qt::WA_AcceptTouchEvents); } bool CGraphicsView::viewportEvent(QEvent *event) { qDebug() << "event->type()" << event->type(); switch (event->type()) { case QEvent::TouchBegin: { qDebug() << "In touch begin"; } break; case QEvent::TouchUpdate: { qDebug() << "In touch update"; } break; case QEvent::TouchEnd: { qDebug() << "In touch end"; } break; default: break; } return QGraphicsView::viewportEvent(event); }
In the above sample code, "wid" is an object of QWidget class and CGraphicsView class is inherited from QGraphicsView class.