在 Ubuntu 20.04 中无法获取触摸点面积,但在 Ubuntu 16.04 中可以获取触摸点面积;该怎么办?以前的方法如下:
bool GraphicsView::viewportEvent(QEvent *event){ QEvent::Type type = event->type();
if(type == QEvent::TouchBegin || type == QEvent::TouchUpdate
|| type == QEvent::TouchEnd){
QTouchEvent *pTouchEvent = static_cast<QTouchEvent*>(event);
QList<QTouchEvent::TouchPoint> touchPoints = pTouchEvent->touchPoints();
int nId = 0;
QColor penColor;
foreach (const QTouchEvent::TouchPoint tp, touchPoints) {
qDebug() << "id" << tp.id() << "触摸区域" << tp.ellipseDiameters() << "触摸点" << tp.pos();
}
return true;
}
return QGraphicsView::viewportEvent(event);
}