aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-07-13 13:40:04 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-07-15 20:52:59 +0200
commitc0e72e34863a5628c51e5c3bb42bcc455c310340 (patch)
tree71e661d2c54258a756087627227f4feb39521bae /src/quick
parent151f58dc29f4b53fb46a96d773aee8641593e5c7 (diff)
Replace QTouchEvent::TouchPoint with QEventPoint
It's a cosmetic change at this time, because we have declared using TouchPoint = QEventPoint; Also replace Qt::TouchPointState enum with QEventPoint::State. Task-number: QTBUG-72173 Change-Id: Ife017aa98801c28abc6cccd106f47a95421549de Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/handlers/qquickhandlerpoint.cpp6
-rw-r--r--src/quick/items/qquickevents.cpp74
-rw-r--r--src/quick/items/qquickevents_p_p.h16
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp38
-rw-r--r--src/quick/items/qquickmultipointtoucharea_p.h6
-rw-r--r--src/quick/items/qquickpincharea.cpp14
-rw-r--r--src/quick/items/qquickpincharea_p_p.h2
-rw-r--r--src/quick/items/qquickwindow.cpp52
-rw-r--r--src/quick/items/qquickwindow_p.h2
9 files changed, 105 insertions, 105 deletions
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 &currentPos = 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);