![在 Ubuntu 20.04 中我无法获取触摸点的面积](https://linux22.com/image/950268/%E5%9C%A8%20Ubuntu%2020.04%20%E4%B8%AD%E6%88%91%E6%97%A0%E6%B3%95%E8%8E%B7%E5%8F%96%E8%A7%A6%E6%91%B8%E7%82%B9%E7%9A%84%E9%9D%A2%E7%A7%AF.png)
在 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);
}