Adapt to Qt 6.3 API changes to QMutableEventPoint
This commit is contained in:
parent
1fccb3daf1
commit
9e8b370453
1 changed files with 20 additions and 16 deletions
|
@ -528,7 +528,7 @@ void OffscreenQuickView::Private::updateTouchState(Qt::TouchPointState state, qi
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
point.setState(Qt::TouchPointStationary);
|
point.setState(Qt::TouchPointStationary);
|
||||||
#else
|
#else
|
||||||
static_cast<QMutableEventPoint &>(point).setState(QEventPoint::Stationary);
|
QMutableEventPoint::setState(point, QEventPoint::Stationary);
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}),
|
}),
|
||||||
|
@ -552,17 +552,20 @@ void OffscreenQuickView::Private::updateTouchState(Qt::TouchPointState state, qi
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
QTouchEvent::TouchPoint point;
|
QTouchEvent::TouchPoint point;
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
point.setState(Qt::TouchPointPressed);
|
point.setState(Qt::TouchPointPressed);
|
||||||
#else
|
|
||||||
QMutableEventPoint point;
|
|
||||||
point.setState(QEventPoint::Pressed);
|
|
||||||
#endif
|
|
||||||
point.setId(id + idOffset);
|
point.setId(id + idOffset);
|
||||||
point.setScreenPos(pos);
|
point.setScreenPos(pos);
|
||||||
point.setScenePos(m_view->mapFromGlobal(pos.toPoint()));
|
point.setScenePos(m_view->mapFromGlobal(pos.toPoint()));
|
||||||
point.setPos(m_view->mapFromGlobal(pos.toPoint()));
|
point.setPos(m_view->mapFromGlobal(pos.toPoint()));
|
||||||
|
#else
|
||||||
|
QMutableEventPoint::setState(point, QEventPoint::Pressed);
|
||||||
|
QMutableEventPoint::setId(point, id + idOffset);
|
||||||
|
QMutableEventPoint::setGlobalPosition(point, pos);
|
||||||
|
QMutableEventPoint::setScenePosition(point, m_view->mapFromGlobal(pos.toPoint()));
|
||||||
|
QMutableEventPoint::setPosition(point, m_view->mapFromGlobal(pos.toPoint()));
|
||||||
|
#endif
|
||||||
|
|
||||||
touchPoints.append(point);
|
touchPoints.append(point);
|
||||||
} break;
|
} break;
|
||||||
|
@ -571,35 +574,36 @@ void OffscreenQuickView::Private::updateTouchState(Qt::TouchPointState state, qi
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
auto &point = *changed;
|
auto &point = *changed;
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
point.setLastPos(point.pos());
|
point.setLastPos(point.pos());
|
||||||
point.setLastScenePos(point.scenePos());
|
point.setLastScenePos(point.scenePos());
|
||||||
point.setLastScreenPos(point.screenPos());
|
point.setLastScreenPos(point.screenPos());
|
||||||
point.setState(Qt::TouchPointMoved);
|
point.setState(Qt::TouchPointMoved);
|
||||||
#else
|
|
||||||
auto &point = static_cast<QMutableEventPoint &>(*changed);
|
|
||||||
point.setGlobalLastPosition(point.globalPosition());
|
|
||||||
point.setState(QEventPoint::Updated);
|
|
||||||
#endif
|
|
||||||
point.setScenePos(m_view->mapFromGlobal(pos.toPoint()));
|
point.setScenePos(m_view->mapFromGlobal(pos.toPoint()));
|
||||||
point.setPos(m_view->mapFromGlobal(pos.toPoint()));
|
point.setPos(m_view->mapFromGlobal(pos.toPoint()));
|
||||||
point.setScreenPos(pos);
|
point.setScreenPos(pos);
|
||||||
|
#else
|
||||||
|
QMutableEventPoint::setGlobalLastPosition(point, point.globalPosition());
|
||||||
|
QMutableEventPoint::setState(point, QEventPoint::Updated);
|
||||||
|
QMutableEventPoint::setScenePosition(point, m_view->mapFromGlobal(pos.toPoint()));
|
||||||
|
QMutableEventPoint::setPosition(point, m_view->mapFromGlobal(pos.toPoint()));
|
||||||
|
QMutableEventPoint::setGlobalPosition(point, pos);
|
||||||
|
#endif
|
||||||
} break;
|
} break;
|
||||||
case Qt::TouchPointReleased: {
|
case Qt::TouchPointReleased: {
|
||||||
if (changed == touchPoints.end()) {
|
if (changed == touchPoints.end()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
auto &point = *changed;
|
auto &point = *changed;
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
point.setLastPos(point.pos());
|
point.setLastPos(point.pos());
|
||||||
point.setLastScreenPos(point.screenPos());
|
point.setLastScreenPos(point.screenPos());
|
||||||
point.setState(Qt::TouchPointReleased);
|
point.setState(Qt::TouchPointReleased);
|
||||||
#else
|
#else
|
||||||
auto &point = static_cast<QMutableEventPoint &>(*changed);
|
QMutableEventPoint::setGlobalLastPosition(point, point.globalPosition());
|
||||||
point.setGlobalLastPosition(point.globalPosition());
|
QMutableEventPoint::setState(point, QEventPoint::Released);
|
||||||
point.setState(QEventPoint::Released);
|
|
||||||
#endif
|
#endif
|
||||||
} break;
|
} break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue