diff options
18 files changed, 255 insertions, 255 deletions
diff --git a/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp b/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp index a9a3534769..24f81c73ff 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp @@ -118,11 +118,11 @@ void InspectTool::hoverMoveEvent(QMouseEvent *event) void InspectTool::touchEvent(QTouchEvent *event) { - QList<QTouchEvent::TouchPoint> touchPoints = event->touchPoints(); + QList<QEventPoint> touchPoints = event->touchPoints(); switch (event->type()) { case QEvent::TouchBegin: - if (touchPoints.count() == 1 && (event->touchPointStates() & Qt::TouchPointPressed)) { + if (touchPoints.count() == 1 && (event->touchPointStates() & QEventPoint::State::Pressed)) { m_mousePosition = touchPoints.first().position(); m_tapEvent = true; } else { @@ -132,7 +132,7 @@ void InspectTool::touchEvent(QTouchEvent *event) case QEvent::TouchUpdate: { if (touchPoints.count() > 1) m_tapEvent = false; - else if ((touchPoints.count() == 1) && (event->touchPointStates() & Qt::TouchPointMoved)) + else if ((touchPoints.count() == 1) && (event->touchPointStates() & QEventPoint::State::Updated)) m_mousePosition = touchPoints.first().position(); break; } diff --git a/src/quick/handlers/qquickhandlerpoint.cpp b/src/quick/handlers/qquickhandlerpoint.cpp index 72efdfd0f4..1155d27afe 100644 --- a/src/quick/handlers/qquickhandlerpoint.cpp +++ b/src/quick/handlers/qquickhandlerpoint.cpp @@ -195,7 +195,7 @@ void QQuickHandlerPoint::reset(const QVector<QQuickHandlerPoint> &points) sequential. Such an assumption is often false due to the way the underlying drivers work. - \sa QTouchEvent::TouchPoint::id + \sa QEventPoint::id */ /*! @@ -294,7 +294,7 @@ void QQuickHandlerPoint::reset(const QVector<QQuickHandlerPoint> &points) nonzero when this point is in motion. It holds the average recent velocity: how fast and in which direction the event point has been moving recently. - \sa QtQuick::EventPoint::velocity, QtQuick::TouchPoint::velocity, QTouchEvent::TouchPoint::velocity + \sa QtQuick::EventPoint::velocity, QtQuick::TouchPoint::velocity, QEventPoint::velocity */ /*! @@ -344,7 +344,7 @@ void QQuickHandlerPoint::reset(const QVector<QQuickHandlerPoint> &points) If the contact patch is unknown, or the device is not a touchscreen, these values will be zero. - \sa QtQuick::EventTouchPoint::ellipseDiameters, QtQuick::TouchPoint::ellipseDiameters, QTouchEvent::TouchPoint::ellipseDiameters + \sa QtQuick::EventTouchPoint::ellipseDiameters, QtQuick::TouchPoint::ellipseDiameters, QEventPoint::ellipseDiameters */ QT_END_NAMESPACE diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index 4b51373837..57693e169e 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -708,14 +708,14 @@ static const QString pointDeviceName(const QQuickEventPoint *point) animation to show progress toward activation of the "long press" action. */ -void QQuickEventPoint::reset(Qt::TouchPointState state, const QPointF &scenePos, int pointId, ulong timestamp, const QVector2D &velocity) +void QQuickEventPoint::reset(QEventPoint::State state, const QPointF &scenePos, int pointId, ulong timestamp, const QVector2D &velocity) { m_scenePos = scenePos; m_pointId = pointId; m_accept = false; m_state = static_cast<QQuickEventPoint::State>(state); m_timestamp = timestamp; - if (state == Qt::TouchPointPressed) { + if (state == QEventPoint::State::Pressed) { m_pressTimestamp = timestamp; m_scenePressPos = scenePos; } @@ -1054,7 +1054,7 @@ QQuickEventTouchPoint::QQuickEventTouchPoint(QQuickPointerTouchEvent *parent) : QQuickEventPoint(parent), m_rotation(0), m_pressure(0) {} -void QQuickEventTouchPoint::reset(const QTouchEvent::TouchPoint &tp, ulong timestamp) +void QQuickEventTouchPoint::reset(const QEventPoint &tp, ulong timestamp) { QQuickEventPoint::reset(tp.state(), tp.scenePosition(), tp.id(), timestamp, tp.velocity()); m_exclusiveGrabber.clear(); @@ -1228,19 +1228,19 @@ QQuickPointerEvent *QQuickPointerMouseEvent::reset(QEvent *event) QQuickPointerHandlerPrivate::deviceDeliveryTargets(ev->device()).clear(); m_button = ev->button(); m_pressedButtons = ev->buttons(); - Qt::TouchPointState state = Qt::TouchPointStationary; + QEventPoint::State state = QEventPoint::State::Stationary; switch (ev->type()) { case QEvent::MouseButtonPress: m_point->clearPassiveGrabbers(); Q_FALLTHROUGH(); case QEvent::MouseButtonDblClick: - state = Qt::TouchPointPressed; + state = QEventPoint::State::Pressed; break; case QEvent::MouseButtonRelease: - state = Qt::TouchPointReleased; + state = QEventPoint::State::Released; break; case QEvent::MouseMove: - state = Qt::TouchPointMoved; + state = QEventPoint::State::Updated; break; default: break; @@ -1266,7 +1266,7 @@ QQuickPointerEvent *QQuickPointerTouchEvent::reset(QEvent *event) m_button = Qt::NoButton; m_pressedButtons = Qt::NoButton; - const QList<QTouchEvent::TouchPoint> &tps = ev->touchPoints(); + const QList<QEventPoint> &tps = ev->touchPoints(); int newPointCount = tps.count(); m_touchPoints.reserve(newPointCount); @@ -1345,13 +1345,13 @@ QQuickPointerEvent *QQuickPointerNativeGestureEvent::reset(QEvent *event) return this; QQuickPointerHandlerPrivate::deviceDeliveryTargets(ev->device()).clear(); - Qt::TouchPointState state = Qt::TouchPointMoved; + QEventPoint::State state = QEventPoint::State::Updated; switch (type()) { case Qt::BeginNativeGesture: - state = Qt::TouchPointPressed; + state = QEventPoint::State::Pressed; break; case Qt::EndNativeGesture: - state = Qt::TouchPointReleased; + state = QEventPoint::State::Released; break; default: break; @@ -1521,7 +1521,7 @@ QQuickPointerEvent *QQuickPointerScrollEvent::reset(QEvent *event) m_synthSource = ev->source(); m_inverted = ev->inverted(); - m_point->reset(Qt::TouchPointMoved, ev->position(), quint64(1) << 24, ev->timestamp()); // mouse has device ID 1 + m_point->reset(QEventPoint::State::Updated, ev->position(), quint64(1) << 24, ev->timestamp()); // mouse has device ID 1 } #endif // TODO else if (event->type() == QEvent::Scroll) ... @@ -1692,11 +1692,11 @@ void QQuickPointerTouchEvent::clearGrabbers() const } } -Qt::TouchPointStates QQuickPointerTouchEvent::touchPointStates() const +QEventPoint::States QQuickPointerTouchEvent::touchPointStates() const { return m_event ? static_cast<QTouchEvent*>(m_event)->touchPointStates() - : Qt::TouchPointStates(); + : QEventPoint::States(); } /*! @@ -1713,17 +1713,17 @@ bool QQuickPointerTouchEvent::hasExclusiveGrabber(const QQuickPointerHandler *ha bool QQuickPointerTouchEvent::isPressEvent() const { - return touchPointStates() & Qt::TouchPointPressed; + return touchPointStates() & QEventPoint::State::Pressed; } bool QQuickPointerTouchEvent::isUpdateEvent() const { - return touchPointStates() & (Qt::TouchPointMoved | Qt::TouchPointStationary); + return touchPointStates() & (QEventPoint::State::Updated | QEventPoint::State::Stationary); } bool QQuickPointerTouchEvent::isReleaseEvent() const { - return touchPointStates() & Qt::TouchPointReleased; + return touchPointStates() & QEventPoint::State::Released; } QVector<QPointF> QQuickPointerEvent::unacceptedPressedPointScenePositions() const @@ -1745,20 +1745,20 @@ QVector<QPointF> QQuickPointerEvent::unacceptedPressedPointScenePositions() cons */ QMouseEvent *QQuickPointerTouchEvent::syntheticMouseEvent(int pointID, QQuickItem *relativeTo) const { - const QTouchEvent::TouchPoint *p = touchPointById(pointID); + const QEventPoint *p = touchPointById(pointID); if (!p) return nullptr; QEvent::Type type; Qt::MouseButton buttons = Qt::LeftButton; switch (p->state()) { - case Qt::TouchPointPressed: + case QEventPoint::State::Pressed: type = QEvent::MouseButtonPress; break; - case Qt::TouchPointMoved: - case Qt::TouchPointStationary: + case QEventPoint::State::Updated: + case QEventPoint::State::Stationary: type = QEvent::MouseMove; break; - case Qt::TouchPointReleased: + case QEventPoint::State::Released: type = QEvent::MouseButtonRelease; buttons = Qt::NoButton; break; @@ -1807,17 +1807,17 @@ QQuickEventTabletPoint::QQuickEventTabletPoint(QQuickPointerTabletEvent *parent) void QQuickEventTabletPoint::reset(const QTabletEvent *ev) { - Qt::TouchPointState state = Qt::TouchPointStationary; + QEventPoint::State state = QEventPoint::State::Stationary; switch (ev->type()) { case QEvent::TabletPress: - state = Qt::TouchPointPressed; + state = QEventPoint::State::Pressed; clearPassiveGrabbers(); break; case QEvent::TabletRelease: - state = Qt::TouchPointReleased; + state = QEventPoint::State::Released; break; case QEvent::TabletMove: - state = Qt::TouchPointMoved; + state = QEventPoint::State::Updated; break; default: break; @@ -1946,17 +1946,17 @@ QQuickEventPoint *QQuickPointerTouchEvent::pointById(int pointId) const /*! \internal Returns a pointer to the original TouchPoint which has the same - \l {QTouchEvent::TouchPoint::id}{id} as \a pointId, if the original event is a + \l {QEventPoint::id}{id} as \a pointId, if the original event is a QTouchEvent, and if that point is found. Otherwise, returns nullptr. */ -const QTouchEvent::TouchPoint *QQuickPointerTouchEvent::touchPointById(int pointId) const +const QEventPoint *QQuickPointerTouchEvent::touchPointById(int pointId) const { const QTouchEvent *ev = asTouchEvent(); if (!ev) return nullptr; - const QList<QTouchEvent::TouchPoint> &tps = ev->touchPoints(); + const QList<QEventPoint> &tps = ev->touchPoints(); auto it = std::find_if(tps.constBegin(), tps.constEnd(), - [pointId](QTouchEvent::TouchPoint const& tp) { return tp.id() == pointId; } ); + [pointId](QEventPoint const& tp) { return tp.id() == pointId; } ); // return the pointer to the actual TP in QTouchEvent::_touchPoints return (it == tps.constEnd() ? nullptr : &*it); } @@ -1974,8 +1974,8 @@ const QTouchEvent::TouchPoint *QQuickPointerTouchEvent::touchPointById(int point */ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool isFiltering) const { - QList<QTouchEvent::TouchPoint> touchPoints; - Qt::TouchPointStates eventStates; + QList<QEventPoint> touchPoints; + QEventPoint::States eventStates; // TODO maybe add QQuickItem::mapVector2DFromScene(QVector2D) to avoid needing QQuickItemPrivate here // Or else just document that velocity is always scene-relative and is not scaled and rotated with the item // but that would require changing tst_qquickwindow::touchEvent_velocity(): it expects transformed velocity @@ -2012,12 +2012,12 @@ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool i continue; if ((p->state() == QQuickEventPoint::Pressed || p->state() == QQuickEventPoint::Released) && isInside) anyPressOrReleaseInside = true; - const QTouchEvent::TouchPoint *tp = touchPointById(p->pointId()); + const QEventPoint *tp = touchPointById(p->pointId()); if (tp) { if (isInside && tp->d->stationaryWithModifiedProperty) anyStationaryWithModifiedPropertyInside = true; eventStates |= tp->state(); - QTouchEvent::TouchPoint tpCopy = *tp; + QEventPoint tpCopy = *tp; tpCopy.setPos(item->mapFromScene(tpCopy.scenePosition())); tpCopy.setLastPos(item->mapFromScene(tpCopy.lastScenePos())); tpCopy.setStartPos(item->mapFromScene(tpCopy.scenePressPosition())); @@ -2029,7 +2029,7 @@ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool i // Now touchPoints will have only points which are inside the item. // But if none of them were just pressed inside, and the item has no other reason to care, ignore them anyway. - if ((eventStates == Qt::TouchPointStationary && !anyStationaryWithModifiedPropertyInside) || + if ((eventStates == QEventPoint::State::Stationary && !anyStationaryWithModifiedPropertyInside) || touchPoints.isEmpty() || (!anyPressOrReleaseInside && !anyGrabber && !isFiltering)) return nullptr; @@ -2037,10 +2037,10 @@ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool i const QTouchEvent &event = *asTouchEvent(); QEvent::Type eventType = event.type(); switch (eventStates) { - case Qt::TouchPointPressed: + case QEventPoint::State::Pressed: eventType = QEvent::TouchBegin; break; - case Qt::TouchPointReleased: + case QEventPoint::State::Released: eventType = QEvent::TouchEnd; break; default: diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index 52ae1bab94..b491445323 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -288,10 +288,10 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventPoint : public QObject public: enum State { - Pressed = Qt::TouchPointPressed, - Updated = Qt::TouchPointMoved, - Stationary = Qt::TouchPointStationary, - Released = Qt::TouchPointReleased + Pressed = QEventPoint::State::Pressed, + Updated = QEventPoint::State::Updated, + Stationary = QEventPoint::State::Stationary, + Released = QEventPoint::State::Released }; Q_DECLARE_FLAGS(States, State) Q_FLAG(States) @@ -309,7 +309,7 @@ public: QQuickEventPoint(QQuickPointerEvent *parent); - void reset(Qt::TouchPointState state, const QPointF &scenePosition, int pointId, ulong timestamp, const QVector2D &velocity = QVector2D()); + void reset(QEventPoint::State state, const QPointF &scenePosition, int pointId, ulong timestamp, const QVector2D &velocity = QVector2D()); void localizePosition(QQuickItem *target); QQuickPointerEvent *pointerEvent() const; @@ -384,7 +384,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventTouchPoint : public QQuickEventPoint public: QQuickEventTouchPoint(QQuickPointerTouchEvent *parent); - void reset(const QTouchEvent::TouchPoint &tp, ulong timestamp); + void reset(const QEventPoint &tp, ulong timestamp); qreal rotation() const { return m_rotation; } qreal pressure() const { return m_pressure; } @@ -551,7 +551,7 @@ public: int pointCount() const override { return m_pointCount; } QQuickEventPoint *point(int i) const override; QQuickEventPoint *pointById(int pointId) const override; - const QTouchEvent::TouchPoint *touchPointById(int pointId) const; + const QEventPoint *touchPointById(int pointId) const; bool allPointsAccepted() const override; bool allUpdatedPointsAccepted() const override; bool allPointsGrabbed() const override; @@ -565,7 +565,7 @@ public: QTouchEvent *asTouchEvent() const; private: - Qt::TouchPointStates touchPointStates() const; + QEventPoint::States touchPointStates() const; int m_pointCount = 0; QVector<QQuickEventTouchPoint *> m_touchPoints; diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index 635f54c857..e230b1285d 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -149,7 +149,7 @@ void QQuickTouchPoint::setPressure(qreal pressure) positive angle means it's rotated to the right. Most touchscreens do not detect rotation, so zero is the most common value. - \sa QTouchEvent::TouchPoint::rotation() + \sa QEventPoint::rotation() */ void QQuickTouchPoint::setRotation(qreal r) { @@ -576,7 +576,7 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event) bool started = false; clearTouchLists(); - QList<QTouchEvent::TouchPoint> touchPoints; + QList<QEventPoint> touchPoints; QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window()); switch (event->type()) { @@ -586,7 +586,7 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event) touchPoints = static_cast<QTouchEvent*>(event)->touchPoints(); break; case QEvent::MouseButtonPress: - _mouseQpaTouchPoint = QTouchEvent::TouchPoint(windowPriv->touchMouseId); + _mouseQpaTouchPoint = QEventPoint(windowPriv->touchMouseId); _touchMouseDevice = windowPriv->touchMouseDevice; Q_FALLTHROUGH(); case QEvent::MouseMove: @@ -596,16 +596,16 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event) _mouseQpaTouchPoint.setScenePos(me->scenePosition()); _mouseQpaTouchPoint.setScreenPos(me->globalPosition()); if (event->type() == QEvent::MouseMove) - _mouseQpaTouchPoint.setState(Qt::TouchPointMoved); + _mouseQpaTouchPoint.setState(QEventPoint::State::Updated); else if (event->type() == QEvent::MouseButtonRelease) - _mouseQpaTouchPoint.setState(Qt::TouchPointReleased); + _mouseQpaTouchPoint.setState(QEventPoint::State::Released); else { // QEvent::MouseButtonPress addTouchPoint(me); started = true; _mouseQpaTouchPoint.setStartPos(me->position()); _mouseQpaTouchPoint.setStartScenePos(me->scenePosition()); _mouseQpaTouchPoint.setStartScreenPos(me->globalPosition()); - _mouseQpaTouchPoint.setState(Qt::TouchPointPressed); + _mouseQpaTouchPoint.setState(QEventPoint::State::Pressed); } touchPoints << _mouseQpaTouchPoint; break; @@ -617,10 +617,10 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event) int numTouchPoints = touchPoints.count(); //always remove released touches, and make sure we handle all releases before adds. - for (const QTouchEvent::TouchPoint &p : qAsConst(touchPoints)) { - Qt::TouchPointState touchPointState = p.state(); + for (const QEventPoint &p : qAsConst(touchPoints)) { + QEventPoint::State touchPointState = p.state(); int id = p.id(); - if (touchPointState & Qt::TouchPointReleased) { + if (touchPointState & QEventPoint::State::Released) { QQuickTouchPoint* dtp = static_cast<QQuickTouchPoint*>(_touchPoints.value(id)); if (!dtp) continue; @@ -632,16 +632,16 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event) } } if (numTouchPoints >= _minimumTouchPoints && numTouchPoints <= _maximumTouchPoints) { - for (const QTouchEvent::TouchPoint &p : qAsConst(touchPoints)) { - Qt::TouchPointState touchPointState = p.state(); + for (const QEventPoint &p : qAsConst(touchPoints)) { + QEventPoint::State touchPointState = p.state(); int id = p.id(); - if (touchPointState & Qt::TouchPointReleased) { + if (touchPointState & QEventPoint::State::Released) { //handled above } else if (!_touchPoints.contains(id)) { //could be pressed, moved, or stationary // (we may have just obtained enough points to start tracking them -- in that case moved or stationary count as newly pressed) addTouchPoint(&p); started = true; - } else if ((touchPointState & Qt::TouchPointMoved) || p.d->stationaryWithModifiedProperty) { + } else if ((touchPointState & QEventPoint::State::Updated) || p.d->stationaryWithModifiedProperty) { // React to a stationary point with a property change (velocity, pressure) as if the point moved. (QTBUG-77142) QQuickTouchPoint* dtp = static_cast<QQuickTouchPoint*>(_touchPoints.value(id)); Q_ASSERT(dtp); @@ -659,8 +659,8 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event) if (!_stealMouse /* !ignoring gesture*/) { bool offerGrab = false; const int dragThreshold = QGuiApplication::styleHints()->startDragDistance(); - for (const QTouchEvent::TouchPoint &p : qAsConst(touchPoints)) { - if (p.state() == Qt::TouchPointReleased) + for (const QEventPoint &p : qAsConst(touchPoints)) { + if (p.state() == QEventPoint::State::Released) continue; const QPointF ¤tPos = p.scenePosition(); const QPointF &startPos = p.scenePressPosition(); @@ -707,7 +707,7 @@ void QQuickMultiPointTouchArea::clearTouchLists() _movedTouchPoints.clear(); } -void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) +void QQuickMultiPointTouchArea::addTouchPoint(const QEventPoint *p) { QQuickTouchPoint *dtp = nullptr; for (QQuickTouchPoint* tp : qAsConst(_touchPrototypes)) { @@ -779,7 +779,7 @@ void QQuickMultiPointTouchArea::addTouchPrototype(QQuickTouchPoint *prototype) _touchPrototypes.insert(id, prototype); } -void QQuickMultiPointTouchArea::updateTouchPoint(QQuickTouchPoint *dtp, const QTouchEvent::TouchPoint *p) +void QQuickMultiPointTouchArea::updateTouchPoint(QQuickTouchPoint *dtp, const QEventPoint *p) { //TODO: if !qmlDefined, could bypass setters. // also, should only emit signals after all values have been set @@ -968,7 +968,7 @@ bool QQuickMultiPointTouchArea::childMouseEventFilter(QQuickItem *receiver, QEve Q_FALLTHROUGH(); case QEvent::TouchUpdate: for (auto tp : static_cast<QTouchEvent*>(event)->touchPoints()) { - if (tp.state() == Qt::TouchPointPressed) + if (tp.state() == QEventPoint::State::Pressed) _lastFilterableTouchPointIds << tp.id(); } if (!shouldFilter(event)) @@ -1008,7 +1008,7 @@ bool QQuickMultiPointTouchArea::shouldFilter(QEvent *event) case QEvent::TouchUpdate: case QEvent::TouchEnd: { QTouchEvent *te = static_cast<QTouchEvent*>(event); - for (const QTouchEvent::TouchPoint &point : te->touchPoints()) { + for (const QEventPoint &point : te->touchPoints()) { if (contains(mapFromScene(point.scenePosition()))) { containsPoint = true; break; diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index 1df4912585..693ceea50c 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -271,11 +271,11 @@ protected: void touchUngrabEvent() override; void addTouchPrototype(QQuickTouchPoint* prototype); - void addTouchPoint(const QTouchEvent::TouchPoint *p); + void addTouchPoint(const QEventPoint *p); void addTouchPoint(const QMouseEvent *e); void clearTouchLists(); - void updateTouchPoint(QQuickTouchPoint*, const QTouchEvent::TouchPoint*); + void updateTouchPoint(QQuickTouchPoint*, const QEventPoint*); void updateTouchPoint(QQuickTouchPoint *dtp, const QMouseEvent *e); void updateTouchData(QEvent*); @@ -300,7 +300,7 @@ private: int _maximumTouchPoints; QVector<int> _lastFilterableTouchPointIds; QPointer<QQuickTouchPoint> _mouseTouchPoint; // exists when mouse button is down and _mouseEnabled is true; null otherwise - QTouchEvent::TouchPoint _mouseQpaTouchPoint; // synthetic QPA touch point to hold state and position of the mouse + QEventPoint _mouseQpaTouchPoint; // synthetic QPA touch point to hold state and position of the mouse const QPointingDevice *_touchMouseDevice; QPointF _mousePos; bool _stealMouse; diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index 3051e4b788..c021e5181c 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -336,7 +336,7 @@ void QQuickPinchArea::touchEvent(QTouchEvent *event) case QEvent::TouchUpdate: d->touchPoints.clear(); for (int i = 0; i < event->touchPoints().count(); ++i) { - if (!(event->touchPoints().at(i).state() & Qt::TouchPointReleased)) { + if (!(event->touchPoints().at(i).state() & QEventPoint::State::Released)) { d->touchPoints << event->touchPoints().at(i); } } @@ -465,13 +465,13 @@ void QQuickPinchArea::updatePinch() return; } - QTouchEvent::TouchPoint touchPoint1 = d->touchPoints.at(0); - QTouchEvent::TouchPoint touchPoint2 = d->touchPoints.at(d->touchPoints. count() >= 2 ? 1 : 0); + QEventPoint touchPoint1 = d->touchPoints.at(0); + QEventPoint touchPoint2 = d->touchPoints.at(d->touchPoints. count() >= 2 ? 1 : 0); - if (touchPoint1.state() == Qt::TouchPointPressed) + if (touchPoint1.state() == QEventPoint::State::Pressed) d->sceneStartPoint1 = touchPoint1.scenePosition(); - if (touchPoint2.state() == Qt::TouchPointPressed) + if (touchPoint2.state() == QEventPoint::State::Pressed) d->sceneStartPoint2 = touchPoint2.scenePosition(); QRectF bounds = clipRect(); @@ -479,7 +479,7 @@ void QQuickPinchArea::updatePinch() // AND one or more of the points has just now been pressed (wasn't pressed already) // AND both points are inside the bounds. if (d->touchPoints.count() == 2 - && (touchPoint1.state() & Qt::TouchPointPressed || touchPoint2.state() & Qt::TouchPointPressed) && + && (touchPoint1.state() & QEventPoint::State::Pressed || touchPoint2.state() & QEventPoint::State::Pressed) && bounds.contains(touchPoint1.position()) && bounds.contains(touchPoint2.position())) { d->id1 = touchPoint1.id(); d->pinchActivated = true; @@ -642,7 +642,7 @@ bool QQuickPinchArea::childMouseEventFilter(QQuickItem *i, QEvent *e) QTouchEvent *touch = static_cast<QTouchEvent*>(e); d->touchPoints.clear(); for (int i = 0; i < touch->touchPoints().count(); ++i) - if (!(touch->touchPoints().at(i).state() & Qt::TouchPointReleased)) + if (!(touch->touchPoints().at(i).state() & QEventPoint::State::Released)) d->touchPoints << touch->touchPoints().at(i); updatePinch(); } diff --git a/src/quick/items/qquickpincharea_p_p.h b/src/quick/items/qquickpincharea_p_p.h index d31c90f080..986aa53900 100644 --- a/src/quick/items/qquickpincharea_p_p.h +++ b/src/quick/items/qquickpincharea_p_p.h @@ -103,7 +103,7 @@ public: QPointF pinchStartCenter; QPointF sceneLastCenter; QPointF pinchStartPos; - QList<QTouchEvent::TouchPoint> touchPoints; + QList<QEventPoint> touchPoints; int id1; }; diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 30c3ae9b63..9c9b99bca5 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -854,7 +854,7 @@ QQmlListProperty<QObject> QQuickWindowPrivate::data() QQuickWindowPrivate::data_removeLast); } -static QMouseEvent *touchToMouseEvent(QEvent::Type type, const QTouchEvent::TouchPoint &p, QTouchEvent *event, QQuickItem *item, bool transformNeeded = true) +static QMouseEvent *touchToMouseEvent(QEvent::Type type, const QEventPoint &p, QTouchEvent *event, QQuickItem *item, bool transformNeeded = true) { Q_ASSERT(QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)); // The touch point local position and velocity are not yet transformed. @@ -928,9 +928,9 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve // Any of the fingers can become the mouse one. // This can happen because a mouse area might not accept an event at some point but another. for (int i = 0; i < event->touchPoints().count(); ++i) { - const QTouchEvent::TouchPoint &p = event->touchPoints().at(i); + const QEventPoint &p = event->touchPoints().at(i); // A new touch point - if (touchMouseId == -1 && p.state() & Qt::TouchPointPressed) { + if (touchMouseId == -1 && p.state() & QEventPoint::State::Pressed) { QPointF pos = item->mapFromScene(p.scenePosition()); // probably redundant, we check bounds in the calling function (matchingNewPoints) @@ -967,7 +967,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve // Touch point was there before and moved } else if (touchMouseDevice == device && p.id() == touchMouseId) { - if (p.state() & Qt::TouchPointMoved) { + if (p.state() & QEventPoint::State::Updated) { if (touchMousePressTimestamp != 0) { const int doubleTapDistance = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::TouchDoubleTapDistance).toInt(); const QPoint moveDelta = p.globalPosition().toPoint() - touchMousePressPos; @@ -1001,7 +1001,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve me->setAccepted(accepted); break; } - } else if (p.state() & Qt::TouchPointReleased) { + } else if (p.state() & QEventPoint::State::Released) { // currently handled point was released if (QQuickItem *mouseGrabberItem = q->mouseGrabberItem()) { QScopedPointer<QMouseEvent> me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event.data(), mouseGrabberItem, false)); @@ -1136,9 +1136,9 @@ Translates the data in \a touchEvent to this window. This method leaves the ite */ void QQuickWindowPrivate::translateTouchEvent(QTouchEvent *touchEvent) { - QList<QTouchEvent::TouchPoint> touchPoints = touchEvent->touchPoints(); + QList<QEventPoint> touchPoints = touchEvent->touchPoints(); for (int i = 0; i < touchPoints.count(); ++i) { - QTouchEvent::TouchPoint &touchPoint = touchPoints[i]; + QEventPoint &touchPoint = touchPoints[i]; touchPoint.setScenePos(touchPoint.position()); touchPoint.setStartScenePos(touchPoint.pressPosition()); touchPoint.setLastScenePos(touchPoint.lastPos()); @@ -1924,7 +1924,7 @@ bool QQuickWindowPrivate::clearHover(ulong timestamp) pos = q->mapFromGlobal(QCursor::pos()); const auto dev = QPointingDevice::primaryPointingDevice(); QQuickPointerEvent *pointerEvent = pointerEventInstance(dev, QEvent::MouseMove); - pointerEvent->point(0)->reset(Qt::TouchPointMoved, pos, int(dev->systemId()), timestamp, QVector2D()); + pointerEvent->point(0)->reset(QEventPoint::State::Updated, pos, int(dev->systemId()), timestamp, QVector2D()); pointerEvent->point(0)->setAccepted(true); pointerEvent->localize(item); for (QQuickPointerHandler *h : itemPrivate->extra->pointerHandlers) @@ -2273,7 +2273,7 @@ bool QQuickWindowPrivate::deliverHoverEvent(QQuickItem *item, const QPointF &sce if (itemPrivate->hasPointerHandlers()) { const auto dev = QPointingDevice::primaryPointingDevice(); QQuickPointerEvent *pointerEvent = pointerEventInstance(dev, QEvent::MouseMove); - pointerEvent->point(0)->reset(Qt::TouchPointMoved, scenePos, dev->systemId(), timestamp, QVector2D()); + pointerEvent->point(0)->reset(QEventPoint::State::Updated, scenePos, dev->systemId(), timestamp, QVector2D()); pointerEvent->point(0)->setAccepted(true); pointerEvent->localize(item); for (QQuickPointerHandler *h : itemPrivate->extra->pointerHandlers) @@ -2446,9 +2446,9 @@ void QQuickWindowPrivate::deliverDelayedTouchEvent() bool QQuickWindowPrivate::compressTouchEvent(QTouchEvent *event) { Q_Q(QQuickWindow); - Qt::TouchPointStates states = event->touchPointStates(); - if (((states & (Qt::TouchPointMoved | Qt::TouchPointStationary)) == 0) - || ((states & (Qt::TouchPointPressed | Qt::TouchPointReleased)) != 0)) { + QEventPoint::States states = event->touchPointStates(); + if (((states & (QEventPoint::State::Updated | QEventPoint::State::Stationary)) == 0) + || ((states & (QEventPoint::State::Pressed | QEventPoint::State::Released)) != 0)) { // we can only compress something that isn't a press or release return false; } @@ -2472,18 +2472,18 @@ bool QQuickWindowPrivate::compressTouchEvent(QTouchEvent *event) // possible match.. is it really the same? bool mismatch = false; - QList<QTouchEvent::TouchPoint> tpts = event->touchPoints(); - Qt::TouchPointStates states; + QList<QEventPoint> tpts = event->touchPoints(); + QEventPoint::States states; for (int i = 0; i < event->touchPoints().count(); ++i) { - const QTouchEvent::TouchPoint &tp = tpts.at(i); - const QTouchEvent::TouchPoint &tpDelayed = delayedTouch->touchPoints().at(i); + const QEventPoint &tp = tpts.at(i); + const QEventPoint &tpDelayed = delayedTouch->touchPoints().at(i); if (tp.id() != tpDelayed.id()) { mismatch = true; break; } - if (tpDelayed.state() == Qt::TouchPointMoved && tp.state() == Qt::TouchPointStationary) - tpts[i].setState(Qt::TouchPointMoved); + if (tpDelayed.state() == QEventPoint::State::Updated && tp.state() == QEventPoint::State::Stationary) + tpts[i].setState(QEventPoint::State::Updated); tpts[i].setLastPos(tpDelayed.lastPos()); tpts[i].setLastScenePos(tpDelayed.lastScenePos()); tpts[i].setLastScreenPos(tpDelayed.lastScreenPos()); @@ -2517,7 +2517,7 @@ void QQuickWindowPrivate::handleTouchEvent(QTouchEvent *event) translateTouchEvent(event); if (event->touchPoints().size()) { auto point = event->touchPoints().at(0); - if (point.state() == Qt::TouchPointReleased) { + if (point.state() == QEventPoint::State::Released) { lastMousePosition = QPointF(); } else { lastMousePosition = point.position(); @@ -3106,7 +3106,7 @@ void QQuickWindowPrivate::deliverMatchingPointsToItem(QQuickItem *item, QQuickPo // But if the event was not accepted then we know this item // will not be interested in further updates for those touchpoint IDs either. for (const auto &point: qAsConst(touchEvent->touchPoints())) { - if (point.state() == Qt::TouchPointPressed) { + if (point.state() == QEventPoint::State::Pressed) { if (auto *tp = ptEvent->pointById(point.id())) { if (tp->exclusiveGrabber() == item) { qCDebug(DBG_TOUCH_TARGET) << "TP" << Qt::hex << point.id() << "disassociated"; @@ -3321,7 +3321,7 @@ QPair<QQuickItem*, QQuickPointerHandler*> QQuickWindowPrivate::findCursorItemAnd if (itemPrivate->hasCursorHandler) { if (auto handler = itemPrivate->effectiveCursorHandler()) { QQuickPointerEvent *pointerEvent = pointerEventInstance(QPointingDevice::primaryPointingDevice(), QEvent::MouseMove); - pointerEvent->point(0)->reset(Qt::TouchPointMoved, scenePos, quint64(1) << 24 /* mouse has device ID 1 */, 0); + pointerEvent->point(0)->reset(QEventPoint::State::Updated, scenePos, quint64(1) << 24 /* mouse has device ID 1 */, 0); pointerEvent->point(0)->setAccepted(true); pointerEvent->localize(item); if (handler->parentContains(pointerEvent->point(0))) @@ -3404,17 +3404,17 @@ bool QQuickWindowPrivate::sendFilteredPointerEventImpl(QQuickPointerEvent *event } else if (Q_LIKELY(QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents))) { // filteringParent didn't filter the touch event. Give it a chance to filter a synthetic mouse event. for (int i = 0; i < filteringParentTouchEvent->touchPoints().size(); ++i) { - const QTouchEvent::TouchPoint &tp = filteringParentTouchEvent->touchPoints().at(i); + const QEventPoint &tp = filteringParentTouchEvent->touchPoints().at(i); QEvent::Type t; switch (tp.state()) { - case Qt::TouchPointPressed: + case QEventPoint::State::Pressed: t = QEvent::MouseButtonPress; break; - case Qt::TouchPointReleased: + case QEventPoint::State::Released: t = QEvent::MouseButtonRelease; break; - case Qt::TouchPointStationary: + case QEventPoint::State::Stationary: continue; default: t = QEvent::MouseMove; @@ -3500,7 +3500,7 @@ bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent return overThreshold; } -bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, const QTouchEvent::TouchPoint *tp, int startDragThreshold) +bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, const QEventPoint *tp, int startDragThreshold) { QStyleHints *styleHints = qApp->styleHints(); bool overThreshold = qAbs(d) > (startDragThreshold >= 0 ? startDragThreshold : styleHints->startDragDistance()); diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 643e7db9a2..e79f2634e1 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -307,7 +307,7 @@ public: static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event, int startDragThreshold = -1); - static bool dragOverThreshold(qreal d, Qt::Axis axis, const QTouchEvent::TouchPoint *tp, int startDragThreshold = -1); + static bool dragOverThreshold(qreal d, Qt::Axis axis, const QEventPoint *tp, int startDragThreshold = -1); static bool dragOverThreshold(QVector2D delta); diff --git a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp index 0c300cfd4e..89e9fa3f23 100644 --- a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp @@ -186,9 +186,9 @@ void tst_QQuickPinchHandler::pinchProperties() QCOMPARE(rotMaxSpy.count(),1); } -QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) +QEventPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) { - QTouchEvent::TouchPoint touchPoint(id); + QEventPoint touchPoint(id); touchPoint.setPos(i->mapFromScene(p)); touchPoint.setScreenPos(v->mapToGlobal(p)); touchPoint.setScenePos(p); diff --git a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp index cb20168c1d..6f81e6b566 100644 --- a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp @@ -51,13 +51,13 @@ public: }; Q_ENUM(Destination) - Event(Destination d, QEvent::Type t, Qt::TouchPointState s, int grabTransition, QPointF item, QPointF scene) + Event(Destination d, QEvent::Type t, QEventPoint::State s, int grabTransition, QPointF item, QPointF scene) : destination(d), type(t), state(s), grabTransition(grabTransition), posWrtItem(item), posWrtScene(scene) {} Destination destination; QEvent::Type type; // if this represents a QEvent that was received - Qt::TouchPointState state; // if this represents an event (pointer, touch or mouse) + QEventPoint::State state; // if this represents an event (pointer, touch or mouse) int grabTransition; // if this represents an onGrabChanged() notification (QQuickEventPoint::GrabTransition) QPointF posWrtItem; QPointF posWrtScene; @@ -98,46 +98,46 @@ public: : QQuickItem(parent), acceptPointer(false), grabPointer(false), acceptMouse(false), acceptTouch(false), filterTouch(false) {} - inline int grabTransition(bool accept, Qt::TouchPointState state) { - return (accept && (state != Qt::TouchPointReleased)) ? (int)QQuickEventPoint::GrabExclusive : (int)NoGrab; + inline int grabTransition(bool accept, QEventPoint::State state) { + return (accept && (state != QEventPoint::State::Released)) ? (int)QQuickEventPoint::GrabExclusive : (int)NoGrab; } void touchEvent(QTouchEvent *event) { qCDebug(lcPointerTests) << event << "will accept?" << acceptTouch; - for (const QTouchEvent::TouchPoint &tp : event->touchPoints()) + for (const QEventPoint &tp : event->touchPoints()) eventList.append(Event(Event::TouchDestination, event->type(), tp.state(), grabTransition(acceptTouch, tp.state()), tp.position(), tp.scenePosition())); event->setAccepted(acceptTouch); } void mousePressEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabTransition(acceptMouse, Qt::TouchPointPressed), event->position().toPoint(), event->scenePosition())); + eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Pressed, grabTransition(acceptMouse, QEventPoint::State::Pressed), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } void mouseMoveEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointMoved, grabTransition(acceptMouse, Qt::TouchPointMoved), event->position().toPoint(), event->scenePosition())); + eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Updated, grabTransition(acceptMouse, QEventPoint::State::Updated), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } void mouseReleaseEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointReleased, grabTransition(acceptMouse, Qt::TouchPointReleased), event->position().toPoint(), event->scenePosition())); + eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Released, grabTransition(acceptMouse, QEventPoint::State::Released), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } void mouseDoubleClickEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabTransition(acceptMouse, Qt::TouchPointPressed), event->position().toPoint(), event->scenePosition())); + eventList.append(Event(Event::MouseDestination, event->type(), QEventPoint::State::Pressed, grabTransition(acceptMouse, QEventPoint::State::Pressed), event->position().toPoint(), event->scenePosition())); event->setAccepted(acceptMouse); } void mouseUngrabEvent() { qCDebug(lcPointerTests); - eventList.append(Event(Event::MouseDestination, QEvent::UngrabMouse, Qt::TouchPointReleased, QQuickEventPoint::UngrabExclusive, QPoint(0,0), QPoint(0,0))); + eventList.append(Event(Event::MouseDestination, QEvent::UngrabMouse, QEventPoint::State::Released, QQuickEventPoint::UngrabExclusive, QPoint(0,0), QPoint(0,0))); } bool event(QEvent *event) @@ -161,7 +161,7 @@ public: event->type() == QEvent::TouchCancel || event->type() == QEvent::TouchEnd) { QTouchEvent *touch = static_cast<QTouchEvent*>(event); - for (const QTouchEvent::TouchPoint &tp : touch->touchPoints()) + for (const QEventPoint &tp : touch->touchPoints()) eventList.append(Event(Event::FilterDestination, event->type(), tp.state(), QQuickEventPoint::GrabExclusive, tp.position(), tp.scenePosition())); if (filterTouch) event->accept(); @@ -207,7 +207,7 @@ public: setExclusiveGrab(point, true); qCDebug(lcPointerTests) << " " << i << ":" << point << "accepted?" << item->acceptPointer << "grabbed?" << (point->exclusiveGrabber() == this); item->eventList.append(Event(Event::HandlerDestination, QEvent::Pointer, - static_cast<Qt::TouchPointState>(point->state()), + static_cast<QEventPoint::State>(point->state()), item->grabPointer ? (int)QQuickEventPoint::GrabExclusive : (int)NoGrab, eventPos(point), point->scenePosition())); } @@ -218,7 +218,7 @@ public: EventItem *item = qmlobject_cast<EventItem *>(target()); if (item) item->eventList.append(Event(Event::HandlerDestination, QEvent::None, - static_cast<Qt::TouchPointState>(point->state()), stateChange, eventPos(point), point->scenePosition())); + static_cast<QEventPoint::State>(point->state()), stateChange, eventPos(point), point->scenePosition())); } int pressEventCount = 0; @@ -248,16 +248,16 @@ private slots: protected: bool eventFilter(QObject *, QEvent *event) { - Qt::TouchPointState tpState; + QEventPoint::State tpState; switch (event->type()) { case QEvent::MouseButtonPress: - tpState = Qt::TouchPointPressed; + tpState = QEventPoint::State::Pressed; break; case QEvent::MouseMove: - tpState = Qt::TouchPointMoved; + tpState = QEventPoint::State::Updated; break; case QEvent::MouseButtonRelease: - tpState = Qt::TouchPointReleased; + tpState = QEventPoint::State::Released; break; default: // So far we aren't recording filtered touch events here - they would be quite numerous in some cases @@ -320,19 +320,19 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QTRY_COMPARE(eventItem1->eventList.size(), synthMouse ? 3 : 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, QEventPoint::State::Pressed, NoGrab); if (synthMouse) - QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, NoGrab); p1 += QPoint(10, 0); QTest::touchEvent(window, touchDevice).move(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 4 : 3); - QCOMPARE_EVENT(eventItem1->eventList.size() - 1, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, NoGrab); + QCOMPARE_EVENT(eventItem1->eventList.size() - 1, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, NoGrab); QTest::touchEvent(window, touchDevice).release(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 5 : 4); - QCOMPARE_EVENT(eventItem1->eventList.size() - 1, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, NoGrab); + QCOMPARE_EVENT(eventItem1->eventList.size() - 1, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, NoGrab); eventItem1->eventList.clear(); // Accept touch @@ -341,21 +341,21 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(touchDevice); QCOMPARE(pointerEvent->point(0)->exclusiveGrabber(), eventItem1); p1 += QPoint(10, 0); QTest::touchEvent(window, touchDevice).move(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 4); - QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, NoGrab); - QCOMPARE_EVENT(3, Event::TouchDestination, QEvent::TouchUpdate, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, NoGrab); + QCOMPARE_EVENT(3, Event::TouchDestination, QEvent::TouchUpdate, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); QTest::touchEvent(window, touchDevice).release(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 6); - QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(5, Event::TouchDestination, QEvent::TouchEnd, Qt::TouchPointReleased, NoGrab); + QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(5, Event::TouchDestination, QEvent::TouchEnd, QEventPoint::State::Released, NoGrab); eventItem1->eventList.clear(); // wait to avoid getting a double click event @@ -369,10 +369,10 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 3 : 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, QEventPoint::State::Pressed, NoGrab); if (synthMouse) - QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); QCOMPARE(window->mouseGrabberItem(), synthMouse ? eventItem1 : nullptr); QPointF localPos = eventItem1->mapFromScene(p1); @@ -389,20 +389,20 @@ void tst_PointerHandlers::touchEventDelivery() QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 6 : 3); if (synthMouse) { - QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, NoGrab); - QCOMPARE_EVENT(4, Event::TouchDestination, QEvent::TouchUpdate, Qt::TouchPointMoved, NoGrab); - QCOMPARE_EVENT(5, Event::MouseDestination, QEvent::MouseMove, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, NoGrab); + QCOMPARE_EVENT(4, Event::TouchDestination, QEvent::TouchUpdate, QEventPoint::State::Updated, NoGrab); + QCOMPARE_EVENT(5, Event::MouseDestination, QEvent::MouseMove, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); } QTest::touchEvent(window, touchDevice).release(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 10 : 4); if (synthMouse) { - QCOMPARE_EVENT(6, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(7, Event::TouchDestination, QEvent::TouchEnd, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(8, Event::MouseDestination, QEvent::MouseButtonRelease, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(9, Event::MouseDestination, QEvent::UngrabMouse, Qt::TouchPointReleased, QQuickEventPoint::UngrabExclusive); + QCOMPARE_EVENT(6, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(7, Event::TouchDestination, QEvent::TouchEnd, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(8, Event::MouseDestination, QEvent::MouseButtonRelease, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(9, Event::MouseDestination, QEvent::UngrabMouse, QEventPoint::State::Released, QQuickEventPoint::UngrabExclusive); } else { - QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, NoGrab); + QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, NoGrab); } eventItem1->eventList.clear(); @@ -417,10 +417,10 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), synthMouse ? 3 : 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, QEventPoint::State::Pressed, NoGrab); if (synthMouse) - QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, NoGrab); QCOMPARE(pointerEvent->point(0)->exclusiveGrabber(), nullptr); p1 += QPoint(10, 0); QTest::touchEvent(window, touchDevice).move(0, p1, window); @@ -441,19 +441,19 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); p1 += QPoint(10, 0); QTest::touchEvent(window, touchDevice).move(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 4); - QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, NoGrab); - QCOMPARE_EVENT(3, Event::TouchDestination, QEvent::TouchUpdate, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, NoGrab); + QCOMPARE_EVENT(3, Event::TouchDestination, QEvent::TouchUpdate, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); QTest::touchEvent(window, touchDevice).release(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 6); - QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(5, Event::TouchDestination, QEvent::TouchEnd, Qt::TouchPointReleased, NoGrab); + QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(5, Event::TouchDestination, QEvent::TouchEnd, QEventPoint::State::Released, NoGrab); eventItem1->eventList.clear(); // Accept pointer events @@ -463,19 +463,19 @@ void tst_PointerHandlers::touchEventDelivery() QTest::touchEvent(window, touchDevice).press(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::None, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); - QCOMPARE_EVENT(1, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::None, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(1, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); p1 += QPoint(10, 0); QTest::touchEvent(window, touchDevice).move(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 3); - QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); QTest::touchEvent(window, touchDevice).release(0, p1, window); QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 5); qCDebug(lcPointerTests) << eventItem1->eventList; - QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, QQuickEventPoint::GrabExclusive); - QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::None, Qt::TouchPointReleased, QQuickEventPoint::UngrabExclusive); + QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::None, QEventPoint::State::Released, QQuickEventPoint::UngrabExclusive); eventItem1->eventList.clear(); } @@ -509,8 +509,8 @@ void tst_PointerHandlers::mouseEventDelivery() p1 = QPoint(20, 20); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(eventItem1->eventList.size(), 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); QCOMPARE(window->mouseGrabberItem(), eventItem1); QPointF localPos = eventItem1->mapFromScene(p1); @@ -523,11 +523,11 @@ void tst_PointerHandlers::mouseEventDelivery() p1 += QPoint(10, 0); QTest::mouseMove(window, p1); QCOMPARE(eventItem1->eventList.size(), 3); - QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseMove, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseMove, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(eventItem1->eventList.size(), 5); - QCOMPARE_EVENT(3, Event::MouseDestination, QEvent::MouseButtonRelease, Qt::TouchPointReleased, NoGrab); - QCOMPARE_EVENT(4, Event::MouseDestination, QEvent::UngrabMouse, Qt::TouchPointReleased, QQuickEventPoint::UngrabExclusive); + QCOMPARE_EVENT(3, Event::MouseDestination, QEvent::MouseButtonRelease, QEventPoint::State::Released, NoGrab); + QCOMPARE_EVENT(4, Event::MouseDestination, QEvent::UngrabMouse, QEventPoint::State::Released, QQuickEventPoint::UngrabExclusive); eventItem1->eventList.clear(); // wait to avoid getting a double click event @@ -540,17 +540,17 @@ void tst_PointerHandlers::mouseEventDelivery() p1 = QPoint(20, 20); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_COMPARE(eventItem1->eventList.size(), 3); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::None, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); - QCOMPARE_EVENT(1, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive); - QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, 0); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::None, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(1, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(2, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, 0); p1 += QPoint(10, 0); QTest::mouseMove(window, p1); QCOMPARE(eventItem1->eventList.size(), 4); - QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointMoved, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(3, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Updated, QQuickEventPoint::GrabExclusive); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(eventItem1->eventList.size(), 6); - QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointReleased, QQuickEventPoint::GrabExclusive); - QCOMPARE_EVENT(5, Event::HandlerDestination, QEvent::None, Qt::TouchPointReleased, QQuickEventPoint::UngrabExclusive); + QCOMPARE_EVENT(4, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Released, QQuickEventPoint::GrabExclusive); + QCOMPARE_EVENT(5, Event::HandlerDestination, QEvent::None, QEventPoint::State::Released, QQuickEventPoint::UngrabExclusive); eventItem1->eventList.clear(); } @@ -562,17 +562,17 @@ void tst_PointerHandlers::touchReleaseOutside_data() QTest::addColumn<int>("endIndexToTest"); QTest::addColumn<int>("endDestination"); // Event::Destination QTest::addColumn<int>("endType"); // QEvent::Type - QTest::addColumn<int>("endState"); // Qt::TouchPointState - QTest::addColumn<int>("endGrabState"); // Qt::TouchPointState + QTest::addColumn<int>("endState"); // QEventPoint::State + QTest::addColumn<int>("endGrabState"); // QEventPoint::State QTest::newRow("reject and ignore") << false << false << 6 << 5 << (int)Event::TouchDestination - << (int)QEvent::TouchEnd << (int)Qt::TouchPointReleased << (int)NoGrab; + << (int)QEvent::TouchEnd << (int)QEventPoint::State::Released << (int)NoGrab; QTest::newRow("reject and grab") << false << true << 5 << 4 << (int)Event::HandlerDestination - << (int)QEvent::None << (int)Qt::TouchPointReleased << (int)QQuickEventPoint::UngrabExclusive; + << (int)QEvent::None << (int)QEventPoint::State::Released << (int)QQuickEventPoint::UngrabExclusive; QTest::newRow("accept and ignore") << true << false << 1 << 0 << (int)Event::HandlerDestination - << (int)QEvent::Pointer << (int)Qt::TouchPointPressed << (int)NoGrab; + << (int)QEvent::Pointer << (int)QEventPoint::State::Pressed << (int)NoGrab; QTest::newRow("accept and grab") << true << true << 5 << 4 << (int)Event::HandlerDestination - << (int)QEvent::None << (int)Qt::TouchPointReleased << (int)QQuickEventPoint::UngrabExclusive; + << (int)QEvent::None << (int)QEventPoint::State::Released << (int)QQuickEventPoint::UngrabExclusive; } void tst_PointerHandlers::touchReleaseOutside() @@ -626,8 +626,8 @@ void tst_PointerHandlers::dynamicCreation() QPoint p1(20, 20); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_COMPARE(eventItem1->eventList.size(), 2); - QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab); - QCOMPARE_EVENT(1, Event::MouseDestination, QEvent::MouseButtonPress, Qt::TouchPointPressed, NoGrab); + QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, QEventPoint::State::Pressed, NoGrab); + QCOMPARE_EVENT(1, Event::MouseDestination, QEvent::MouseButtonPress, QEventPoint::State::Pressed, NoGrab); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); } diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index a3340c0e3a..f6a6ab17b4 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -92,7 +92,7 @@ public: int touchUpdates; int touchReleases; int ungrabs; - QVector<Qt::TouchPointState> touchPointStates; + QVector<QEventPoint::State> touchPointStates; protected: void touchEvent(QTouchEvent *ev) override @@ -100,21 +100,21 @@ protected: QCOMPARE(ev->touchPoints().count(), 1); auto touchpoint = ev->touchPoints().first(); switch (touchpoint.state()) { - case Qt::TouchPointPressed: + case QEventPoint::State::Pressed: QVERIFY(!m_active); m_active = true; emit activeChanged(); grabTouchPoints(QList<int>() << touchpoint.id()); break; - case Qt::TouchPointMoved: + case QEventPoint::State::Updated: ++touchUpdates; break; - case Qt::TouchPointReleased: + case QEventPoint::State::Released: QVERIFY(m_active); m_active = false; ++touchReleases; emit activeChanged(); - case Qt::TouchPointStationary: + case QEventPoint::State::Stationary: break; } touchPointStates << touchpoint.state(); @@ -2068,7 +2068,7 @@ void tst_qquickflickable::nestedSliderUsingTouch() QCOMPARE(tda->active(), !ungrabs); QTest::touchEvent(window, touchDevice).release(0, p0, window); QQuickTouchUtils::flush(window); - QTRY_COMPARE(tda->touchPointStates.first(), Qt::TouchPointPressed); + QTRY_COMPARE(tda->touchPointStates.first(), QEventPoint::State::Pressed); QTRY_VERIFY(tda->touchUpdates >= minUpdates); QTRY_COMPARE(tda->touchReleases, releases); QTRY_COMPARE(tda->ungrabs, ungrabs); diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index 924a1d2c4e..0e7ab12074 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -1341,16 +1341,16 @@ void tst_qquickitem::touchEventAcceptIgnore() // Send Begin, Update & End touch sequence { - QTouchEvent::TouchPoint point; + QEventPoint point; point.setId(1); point.setPos(QPointF(50, 50)); point.setScreenPos(point.position()); - point.setState(Qt::TouchPointPressed); + point.setState(QEventPoint::State::Pressed); QTouchEvent event(QEvent::TouchBegin, device, Qt::NoModifier, - Qt::TouchPointPressed, - QList<QTouchEvent::TouchPoint>() << point); + QEventPoint::State::Pressed, + QList<QEventPoint>() << point); event.setAccepted(true); item->touchEventReached = false; @@ -1365,16 +1365,16 @@ void tst_qquickitem::touchEventAcceptIgnore() QCOMPARE(accepted && event.isAccepted(), true); } { - QTouchEvent::TouchPoint point; + QEventPoint point; point.setId(1); point.setPos(QPointF(60, 60)); point.setScreenPos(point.position()); - point.setState(Qt::TouchPointMoved); + point.setState(QEventPoint::State::Updated); QTouchEvent event(QEvent::TouchUpdate, device, Qt::NoModifier, - Qt::TouchPointMoved, - QList<QTouchEvent::TouchPoint>() << point); + QEventPoint::State::Updated, + QList<QEventPoint>() << point); event.setAccepted(true); item->touchEventReached = false; @@ -1389,16 +1389,16 @@ void tst_qquickitem::touchEventAcceptIgnore() QCOMPARE(accepted && event.isAccepted(), true); } { - QTouchEvent::TouchPoint point; + QEventPoint point; point.setId(1); point.setPos(QPointF(60, 60)); point.setScreenPos(point.position()); - point.setState(Qt::TouchPointReleased); + point.setState(QEventPoint::State::Released); QTouchEvent event(QEvent::TouchEnd, device, Qt::NoModifier, - Qt::TouchPointReleased, - QList<QTouchEvent::TouchPoint>() << point); + QEventPoint::State::Released, + QList<QEventPoint>() << point); event.setAccepted(true); item->touchEventReached = false; diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index 04a44a2c10..0806914763 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -1373,10 +1373,10 @@ void tst_QQuickMultiPointTouchArea::stationaryTouchWithChangingPressure() // QTB QCOMPARE(point1->pressed(), false); QPoint p1(20,100); - QTouchEvent::TouchPoint tp1(1); + QEventPoint tp1(1); tp1.setScreenPos(window->mapToGlobal(p1)); - tp1.setState(Qt::TouchPointPressed); + tp1.setState(QEventPoint::State::Pressed); tp1.setPressure(0.5); qt_handleTouchEvent(window.data(), device, {tp1}); QQuickTouchUtils::flush(window.data()); @@ -1384,14 +1384,14 @@ void tst_QQuickMultiPointTouchArea::stationaryTouchWithChangingPressure() // QTB QCOMPARE(point1->pressed(), true); QCOMPARE(point1->pressure(), 0.5); - tp1.setState(Qt::TouchPointStationary); + tp1.setState(QEventPoint::State::Stationary); tp1.setPressure(0.6); qt_handleTouchEvent(window.data(), device, {tp1}); QQuickTouchUtils::flush(window.data()); QCOMPARE(point1->pressure(), 0.6); - tp1.setState(Qt::TouchPointReleased); + tp1.setState(QEventPoint::State::Released); tp1.setPressure(0); qt_handleTouchEvent(window.data(), device, {tp1}); QQuickTouchUtils::flush(window.data()); diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp index 3213d49dd5..b65e12d2be 100644 --- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp +++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp @@ -175,9 +175,9 @@ void tst_QQuickPinchArea::pinchProperties() QCOMPARE(rotMaxSpy.count(),1); } -QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) +QEventPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickItem *i) { - QTouchEvent::TouchPoint touchPoint(id); + QEventPoint touchPoint(id); touchPoint.setPos(i->mapFromScene(p)); touchPoint.setScreenPos(v->mapToGlobal(p)); touchPoint.setScenePos(p); diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index ecb2b7a4a9..ef304894bc 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -64,15 +64,15 @@ struct TouchEventData { QEvent::Type type; QWidget *widget; QWindow *window; - Qt::TouchPointStates states; - QList<QTouchEvent::TouchPoint> touchPoints; + QEventPoint::States states; + QList<QEventPoint> touchPoints; }; -static QTouchEvent::TouchPoint makeTouchPoint(QQuickItem *item, const QPointF &p, const QPointF &lastPoint = QPointF()) +static QEventPoint makeTouchPoint(QQuickItem *item, const QPointF &p, const QPointF &lastPoint = QPointF()) { QPointF last = lastPoint.isNull() ? p : lastPoint; - QTouchEvent::TouchPoint tp; + QEventPoint tp; tp.setPos(p); tp.setLastPos(last); @@ -83,15 +83,15 @@ static QTouchEvent::TouchPoint makeTouchPoint(QQuickItem *item, const QPointF &p return tp; } -static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states = {}, - const QList<QTouchEvent::TouchPoint>& touchPoints = QList<QTouchEvent::TouchPoint>()) +static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, QEventPoint::States states = {}, + const QList<QEventPoint>& touchPoints = QList<QEventPoint>()) { TouchEventData d = { type, nullptr, w, states, touchPoints }; return d; } -static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states, const QTouchEvent::TouchPoint &touchPoint) +static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, QEventPoint::States states, const QEventPoint &touchPoint) { - QList<QTouchEvent::TouchPoint> points; + QList<QEventPoint> points; points << touchPoint; return makeTouchData(type, w, states, points); } @@ -167,7 +167,7 @@ public: setEnabled(true); setVisible(true); - lastEvent = makeTouchData(QEvent::None, window(), {}, QList<QTouchEvent::TouchPoint>());//CHECK_VALID + lastEvent = makeTouchData(QEvent::None, window(), {}, QList<QEventPoint>());//CHECK_VALID lastVelocity = lastVelocityFromMouseMove = QVector2D(); lastMousePos = QPointF(); @@ -213,7 +213,7 @@ public: } else { lastVelocity = QVector2D(); } - if (spinLoopWhenPressed && event->touchPointStates().testFlag(Qt::TouchPointPressed)) { + if (spinLoopWhenPressed && event->touchPointStates().testFlag(QEventPoint::State::Pressed)) { QCoreApplication::processEvents(); } } @@ -649,7 +649,7 @@ void tst_qquickwindow::touchEvent_basic() QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); // At one point this was failing with kwin (KDE window manager) because window->setPosition(100, 100) // would put the decorated window at that position rather than the window itself. - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(topItem, pos))); + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(topItem, pos))); topItem->reset(); touchSeq.release(0, topItem->mapToScene(pos).toPoint(), window).commit(); @@ -660,8 +660,8 @@ void tst_qquickwindow::touchEvent_basic() QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(topItem, pos))); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(bottomItem, pos))); + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(topItem, pos))); + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(bottomItem, pos))); topItem->reset(); bottomItem->reset(); touchSeq.release(0, topItem->mapToScene(pos).toPoint(), window).release(1, bottomItem->mapToScene(pos).toPoint(), window).commit(); @@ -672,7 +672,7 @@ void tst_qquickwindow::touchEvent_basic() touchSeq.move(0, bottomItem->mapToScene(pos).toPoint(), window).commit(); QQuickTouchUtils::flush(window); QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, Qt::TouchPointMoved, + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, QEventPoint::State::Updated, makeTouchPoint(topItem, topItem->mapFromItem(bottomItem, pos), pos))); topItem->reset(); touchSeq.release(0, bottomItem->mapToScene(pos).toPoint(), window).commit(); @@ -683,7 +683,7 @@ void tst_qquickwindow::touchEvent_basic() touchSeq.move(0, topItem->mapToScene(pos).toPoint(), window).commit(); QQuickTouchUtils::flush(window); QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, Qt::TouchPointMoved, + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchUpdate, window, QEventPoint::State::Updated, makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos), pos))); bottomItem->reset(); touchSeq.release(0, bottomItem->mapToScene(pos).toPoint(), window).commit(); @@ -697,8 +697,8 @@ void tst_qquickwindow::touchEvent_basic() QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); // received press only, not stationary QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(topItem, pos))); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(bottomItem, pos))); + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(topItem, pos))); + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(bottomItem, pos))); topItem->reset(); bottomItem->reset(); // cleanup: what is pressed must be released @@ -713,7 +713,7 @@ void tst_qquickwindow::touchEvent_basic() touchSeq.release(0, bottomItem->mapToScene(pos).toPoint(),window).commit(); QQuickTouchUtils::flush(window); QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchEnd, window, Qt::TouchPointReleased, + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchEnd, window, QEventPoint::State::Released, makeTouchPoint(topItem, topItem->mapFromItem(bottomItem, pos), pos))); topItem->reset(); @@ -729,9 +729,9 @@ void tst_qquickwindow::touchEvent_basic() QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchEnd, window, Qt::TouchPointReleased, + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchEnd, window, QEventPoint::State::Released, makeTouchPoint(topItem, topItem->mapFromItem(bottomItem, pos)))); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(bottomItem, pos))); + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(bottomItem, pos))); topItem->reset(); bottomItem->reset(); @@ -788,7 +788,7 @@ void tst_qquickwindow::touchEvent_propagation() QTRY_COMPARE(middleItem->lastEvent.touchPoints.count(), 1); QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); - COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, + COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(middleItem, middleItem->mapFromItem(topItem, pos)))); QTest::touchEvent(window, touchDevice).release(0, pointInTopItem, window); @@ -798,8 +798,8 @@ void tst_qquickwindow::touchEvent_propagation() QTRY_COMPARE(middleItem->lastEvent.touchPoints.count(), 2); QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); - COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, - (QList<QTouchEvent::TouchPoint>() << makeTouchPoint(middleItem, middleItem->mapFromItem(topItem, pos)) + COMPARE_TOUCH_DATA(middleItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, + (QList<QEventPoint>() << makeTouchPoint(middleItem, middleItem->mapFromItem(topItem, pos)) << makeTouchPoint(middleItem, pos) ))); QTest::touchEvent(window, touchDevice).release(0, pointInTopItem, window) .release(1, pointInMiddleItem, window); @@ -817,8 +817,8 @@ void tst_qquickwindow::touchEvent_propagation() QTRY_COMPARE(bottomItem->lastEvent.touchPoints.count(), 2); QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, - (QList<QTouchEvent::TouchPoint>() << makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos)) + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, + (QList<QEventPoint>() << makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos)) << makeTouchPoint(bottomItem, bottomItem->mapFromItem(middleItem, pos)) ))); bottomItem->reset(); @@ -855,14 +855,14 @@ void tst_qquickwindow::touchEvent_propagation() QVERIFY(topItem->lastEvent.touchPoints.isEmpty()); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QCOMPARE(bottomItem->lastEvent.touchPoints.count(), 1); - COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, + COMPARE_TOUCH_DATA(bottomItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(bottomItem, bottomItem->mapFromItem(topItem, pos)))); } else { // middle item ignores event, sends it to the top item (top-most child) QCOMPARE(topItem->lastEvent.touchPoints.count(), 1); QVERIFY(middleItem->lastEvent.touchPoints.isEmpty()); QVERIFY(bottomItem->lastEvent.touchPoints.isEmpty()); - COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, + COMPARE_TOUCH_DATA(topItem->lastEvent, makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(topItem, pos))); } QTest::touchEvent(window, touchDevice).release(0, pointInTopItem, window); @@ -906,7 +906,7 @@ void tst_qquickwindow::touchEvent_cancel() QCoreApplication::processEvents(); QTRY_COMPARE(item->lastEvent.touchPoints.count(), 1); - TouchEventData d = makeTouchData(QEvent::TouchBegin, window, Qt::TouchPointPressed, makeTouchPoint(item, pos)); + TouchEventData d = makeTouchData(QEvent::TouchBegin, window, QEventPoint::State::Pressed, makeTouchPoint(item, pos)); COMPARE_TOUCH_DATA(item->lastEvent, d); item->reset(); @@ -1006,10 +1006,10 @@ void tst_qquickwindow::touchEvent_velocity() item->setPosition(QPointF(50, 50)); item->setSize(QSizeF(150, 150)); - QList<QTouchEvent::TouchPoint> points; - QTouchEvent::TouchPoint tp; + QList<QEventPoint> points; + QEventPoint tp; tp.setId(1); - tp.setState(Qt::TouchPointPressed); + tp.setState(QEventPoint::State::Pressed); const QPointF localPos = item->mapToScene(QPointF(10, 10)); const QPointF screenPos = window->mapToGlobal(localPos.toPoint()); tp.setPos(localPos); @@ -1022,7 +1022,7 @@ void tst_qquickwindow::touchEvent_velocity() QQuickTouchUtils::flush(window); QCOMPARE(item->touchEventCount, 1); - points[0].setState(Qt::TouchPointMoved); + points[0].setState(QEventPoint::State::Updated); points[0].setPos(localPos + QPointF(5, 5)); points[0].setScreenPos(screenPos + QPointF(5, 5)); QVector2D velocity(1.5, 2.5); @@ -1051,7 +1051,7 @@ void tst_qquickwindow::touchEvent_velocity() QPoint itemLocalPosFromEvent = item->lastEvent.touchPoints[0].position().toPoint(); QCOMPARE(itemLocalPos, itemLocalPosFromEvent); - points[0].setState(Qt::TouchPointReleased); + points[0].setState(QEventPoint::State::Released); QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QGuiApplication::processEvents(); @@ -1150,10 +1150,10 @@ void tst_qquickwindow::mouseFromTouch_basic() item->setSize(QSizeF(150, 150)); item->acceptTouchEvents = false; - QList<QTouchEvent::TouchPoint> points; - QTouchEvent::TouchPoint tp; + QList<QEventPoint> points; + QEventPoint tp; tp.setId(1); - tp.setState(Qt::TouchPointPressed); + tp.setState(QEventPoint::State::Pressed); const QPointF localPos = item->mapToScene(QPointF(10, 10)); const QPointF screenPos = window->mapToGlobal(localPos.toPoint()); tp.setPos(localPos); @@ -1164,7 +1164,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QGuiApplication::processEvents(); QQuickTouchUtils::flush(window); - points[0].setState(Qt::TouchPointMoved); + points[0].setState(QEventPoint::State::Updated); points[0].setPos(localPos + QPointF(5, 5)); points[0].setScreenPos(screenPos + QPointF(5, 5)); QVector2D velocity(1.5, 2.5); @@ -1173,7 +1173,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QGuiApplication::processEvents(); QQuickTouchUtils::flush(window); - points[0].setState(Qt::TouchPointReleased); + points[0].setState(QEventPoint::State::Released); QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QGuiApplication::processEvents(); @@ -1192,7 +1192,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QMatrix4x4 transformMatrix; transformMatrix.rotate(-90, 0, 0, 1); // counterclockwise QVector2D transformedVelocity = transformMatrix.mapVector(velocity).toVector2D(); - points[0].setState(Qt::TouchPointPressed); + points[0].setState(QEventPoint::State::Pressed); points[0].setVelocity(velocity); tp.setPos(localPos); tp.setScreenPos(screenPos); @@ -1200,7 +1200,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QGuiApplication::processEvents(); QQuickTouchUtils::flush(window); - points[0].setState(Qt::TouchPointMoved); + points[0].setState(QEventPoint::State::Updated); points[0].setPos(localPos + QPointF(5, 5)); points[0].setScreenPos(screenPos + QPointF(5, 5)); QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, @@ -1210,7 +1210,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(points[0].position()).toPoint()); QCOMPARE(item->lastVelocityFromMouseMove, transformedVelocity); - points[0].setState(Qt::TouchPointReleased); + points[0].setState(QEventPoint::State::Released); QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, QWindowSystemInterfacePrivate::toNativeTouchPoints(points, window)); QCoreApplication::processEvents(); @@ -2846,8 +2846,8 @@ void tst_qquickwindow::pointerEventTypeAndPointCount() QPointF screenPosition(333, 366); QMouseEvent me(QEvent::MouseButtonPress, localPosition, scenePosition, screenPosition, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); - QTouchEvent te(QEvent::TouchBegin, touchDevice, Qt::NoModifier, Qt::TouchPointPressed, - QList<QTouchEvent::TouchPoint>() << QTouchEvent::TouchPoint(1)); + QTouchEvent te(QEvent::TouchBegin, touchDevice, Qt::NoModifier, QEventPoint::State::Pressed, + QList<QEventPoint>() << QEventPoint(1)); QQuickPointerMouseEvent pme(nullptr, QPointingDevice::primaryPointingDevice()); @@ -2874,14 +2874,14 @@ void tst_qquickwindow::pointerEventTypeAndPointCount() QCOMPARE(pte.touchPointById(1)->id(), 1); QVERIFY(!pte.touchPointById(0)); - te.setTouchPoints(QList<QTouchEvent::TouchPoint>() << QTouchEvent::TouchPoint(1) << QTouchEvent::TouchPoint(2)); + te.setTouchPoints(QList<QEventPoint>() << QEventPoint(1) << QEventPoint(2)); pte.reset(&te); QCOMPARE(pte.pointCount(), 2); QCOMPARE(pte.touchPointById(1)->id(), 1); QCOMPARE(pte.touchPointById(2)->id(), 2); QVERIFY(!pte.touchPointById(0)); - te.setTouchPoints(QList<QTouchEvent::TouchPoint>() << QTouchEvent::TouchPoint(2)); + te.setTouchPoints(QList<QEventPoint>() << QEventPoint(2)); pte.reset(&te); QCOMPARE(pte.pointCount(), 1); QCOMPARE(pte.touchPointById(2)->id(), 2); diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 88348b8889..bd838d8d61 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -56,14 +56,14 @@ struct Event :type(t), mousePos(mouse), mousePosGlobal(global) {} - Event(QEvent::Type t, QList<QTouchEvent::TouchPoint> touch) + Event(QEvent::Type t, QList<QEventPoint> touch) :type(t), points(touch) {} QEvent::Type type; QPoint mousePos; QPoint mousePosGlobal; - QList<QTouchEvent::TouchPoint> points; + QList<QEventPoint> points; }; #ifndef QT_NO_DEBUG_STREAM @@ -101,7 +101,7 @@ public: void touchEvent(QTouchEvent *event) { eventList.append(Event(event->type(), event->touchPoints())); - QList<QTouchEvent::TouchPoint> tps = event->touchPoints(); + QList<QEventPoint> tps = event->touchPoints(); Q_ASSERT(!tps.isEmpty()); point0 = tps.first().id(); event->setAccepted(acceptTouch); @@ -156,7 +156,7 @@ public: event->type() == QEvent::TouchEnd) { QTouchEvent *touch = static_cast<QTouchEvent*>(event); eventList.append(Event(event->type(), touch->touchPoints())); - QList<QTouchEvent::TouchPoint> tps = touch->touchPoints(); + QList<QEventPoint> tps = touch->touchPoints(); Q_ASSERT(!tps.isEmpty()); point0 = tps.first().id(); if (filterTouch) |