Fix deprecations in manual tests

QEventPoint instead of TouchPoint:  we have source compatibility for that,
but we can use the new type to avoid the deprecation warnings.
Some position accessors have been renamed too.

Change-Id: I5bfe5bc853931127a883d2bd61fab122495fd427
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Shawn Rutledge 2020-07-07 08:19:12 +02:00
parent 62dad9be9e
commit 2e0f7117b6
4 changed files with 9 additions and 11 deletions

View File

@ -54,17 +54,15 @@ QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::recognize(QGesture
case QEvent::TouchUpdate:
if (d->state() != Qt::NoGesture) {
QTouchEvent *ev = static_cast<QTouchEvent*>(event);
if (ev->touchPoints().size() == 3) {
if (ev->points().size() == 3) {
d->gestureFired = true;
result = QGestureRecognizer::TriggerGesture;
} else {
result = QGestureRecognizer::MayBeGesture;
for (int i = 0; i < ev->touchPoints().size(); ++i) {
const QTouchEvent::TouchPoint &pt = ev->touchPoints().at(i);
const int distance = (pt.pos().toPoint() - pt.startPos().toPoint()).manhattanLength();
if (distance > 20) {
for (const QEventPoint &pt : ev->points()) {
const int distance = (pt.globalPosition().toPoint() - pt.globalPressPosition().toPoint()).manhattanLength();
if (distance > 20)
result = QGestureRecognizer::CancelGesture;
}
}
}
} else {

View File

@ -57,7 +57,7 @@ QGestureRecognizer::Result MousePanGestureRecognizer::recognize(QGesture *state,
case QEvent::MouseButtonPress:
case QEvent::MouseMove:
case QEvent::MouseButtonRelease:
globalPos = static_cast<QMouseEvent *>(event)->globalPos();
globalPos = static_cast<QMouseEvent *>(event)->globalPosition().toPoint();
break;
default:
break;

View File

@ -272,7 +272,7 @@ bool EventReportWidget::event(QEvent *event)
case QEvent::TouchUpdate:
event->accept();
m_touchPoints.clear();
for (const QTouchEvent::TouchPoint &p : static_cast<const QTouchEvent *>(event)->touchPoints())
for (const QEventPoint &p : static_cast<const QPointerEvent *>(event)->points())
m_touchPoints.append(p.position());
update();
break;

View File

@ -344,7 +344,7 @@ bool TouchTestWidget::event(QEvent *event)
case QEvent::MouseButtonRelease:
if (m_drawPoints) {
const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
m_points.append(Point(me->localPos(),
m_points.append(Point(me->position(),
type == QEvent::MouseButtonPress ? MousePress : MouseRelease,
me->source()));
update();
@ -353,8 +353,8 @@ bool TouchTestWidget::event(QEvent *event)
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
if (m_drawPoints) {
for (const QTouchEvent::TouchPoint &p : static_cast<const QTouchEvent *>(event)->touchPoints())
m_points.append(Point(p.pos(), TouchPoint, Qt::MouseEventNotSynthesized, p.ellipseDiameters()));
for (const QEventPoint &p : static_cast<const QPointerEvent *>(event)->points())
m_points.append(Point(p.position(), TouchPoint, Qt::MouseEventNotSynthesized, p.ellipseDiameters()));
update();
}
Q_FALLTHROUGH();