aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quick/items/qquickevents.cpp24
-rw-r--r--src/quick/items/qquickevents_p_p.h11
-rw-r--r--src/quick/items/qquickwindow_p.h8
3 files changed, 16 insertions, 27 deletions
diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp
index cddcf02955..0c06ecd677 100644
--- a/src/quick/items/qquickevents.cpp
+++ b/src/quick/items/qquickevents.cpp
@@ -541,7 +541,6 @@ void QQuickEventPoint::reset(Qt::TouchPointState state, const QPointF &scenePos,
}
m_pointId = pointId;
}
- m_valid = true;
m_accept = false;
m_state = static_cast<QQuickEventPoint::State>(state);
m_timestamp = timestamp;
@@ -552,7 +551,7 @@ void QQuickEventPoint::reset(Qt::TouchPointState state, const QPointF &scenePos,
m_velocity = (Q_LIKELY(velocity.isNull()) ? estimatedVelocity() : velocity);
}
-void QQuickEventPoint::localize(QQuickItem *target)
+void QQuickEventPoint::localizePosition(QQuickItem *target)
{
if (target)
m_pos = target->mapFromScene(scenePos());
@@ -560,12 +559,6 @@ void QQuickEventPoint::localize(QQuickItem *target)
m_pos = QPointF();
}
-void QQuickEventPoint::invalidate()
-{
- m_valid = false;
- m_pointId = 0;
-}
-
/*!
If this point has an exclusive grabber, returns a pointer to it; else
returns null, if there is no grabber. The grabber could be either
@@ -756,13 +749,6 @@ void QQuickEventPoint::setAccepted(bool accepted)
}
}
-bool QQuickEventPoint::isDraggedOverThreshold() const
-{
- QPointF delta = scenePos() - scenePressPos();
- return (QQuickWindowPrivate::dragOverThreshold(delta.x(), Qt::XAxis, this) ||
- QQuickWindowPrivate::dragOverThreshold(delta.y(), Qt::YAxis, this));
-}
-
QQuickEventTouchPoint::QQuickEventTouchPoint(QQuickPointerTouchEvent *parent)
: QQuickEventPoint(parent), m_rotation(0), m_pressure(0)
{}
@@ -885,7 +871,7 @@ QQuickPointerEvent *QQuickPointerMouseEvent::reset(QEvent *event)
void QQuickPointerMouseEvent::localize(QQuickItem *target)
{
- m_mousePoint->localize(target);
+ m_mousePoint->localizePosition(target);
}
QQuickPointerEvent *QQuickPointerTouchEvent::reset(QEvent *event)
@@ -944,7 +930,7 @@ QQuickPointerEvent *QQuickPointerTouchEvent::reset(QEvent *event)
void QQuickPointerTouchEvent::localize(QQuickItem *target)
{
for (auto point : qAsConst(m_touchPoints))
- point->localize(target);
+ point->localizePosition(target);
}
QQuickEventPoint *QQuickPointerMouseEvent::point(int i) const {
@@ -961,7 +947,7 @@ QQuickEventPoint *QQuickPointerTouchEvent::point(int i) const {
QQuickEventPoint::QQuickEventPoint(QQuickPointerEvent *parent)
: QObject(parent), m_pointId(0), m_exclusiveGrabber(nullptr), m_timestamp(0), m_pressTimestamp(0),
- m_state(QQuickEventPoint::Released), m_valid(false), m_accept(false), m_grabberIsHandler(false)
+ m_state(QQuickEventPoint::Released), m_accept(false), m_grabberIsHandler(false)
{
Q_UNUSED(m_reserved);
}
@@ -1306,7 +1292,7 @@ Q_QUICK_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const QQuickPointerEvent *e
Q_QUICK_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const QQuickEventPoint *event) {
QDebugStateSaver saver(dbg);
dbg.nospace();
- dbg << "QQuickEventPoint(valid:" << event->isValid() << " accepted:" << event->isAccepted()
+ dbg << "QQuickEventPoint(accepted:" << event->isAccepted()
<< " state:";
QtDebugUtils::formatQEnum(dbg, event->state());
dbg << " scenePos:" << event->scenePos() << " id:" << hex << event->pointId() << dec
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index ede0ebfde6..51e31bd7d7 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -289,9 +289,7 @@ public:
QQuickEventPoint(QQuickPointerEvent *parent);
void reset(Qt::TouchPointState state, const QPointF &scenePos, quint64 pointId, ulong timestamp, const QVector2D &velocity = QVector2D());
- void localize(QQuickItem *target);
-
- void invalidate();
+ void localizePosition(QQuickItem *target);
QQuickPointerEvent *pointerEvent() const;
QPointF pos() const { return m_pos; }
@@ -301,11 +299,9 @@ public:
QVector2D velocity() const { return m_velocity; }
State state() const { return m_state; }
quint64 pointId() const { return m_pointId; }
- bool isValid() const { return m_valid; }
qreal timeHeld() const { return (m_timestamp - m_pressTimestamp) / 1000.0; }
bool isAccepted() const { return m_accept; }
void setAccepted(bool accepted = true);
- bool isDraggedOverThreshold() const;
QObject *exclusiveGrabber() const;
void setExclusiveGrabber(QObject *exclusiveGrabber);
@@ -315,8 +311,8 @@ public:
QQuickPointerHandler *grabberPointerHandler() const;
void setGrabberPointerHandler(QQuickPointerHandler *exclusiveGrabber, bool exclusive = false);
- Q_INVOKABLE void cancelExclusiveGrab();
- Q_INVOKABLE void cancelPassiveGrab(QQuickPointerHandler *handler);
+ void cancelExclusiveGrab();
+ void cancelPassiveGrab(QQuickPointerHandler *handler);
bool removePassiveGrabber(QQuickPointerHandler *handler);
void cancelAllGrabs(QQuickPointerHandler *handler);
@@ -339,7 +335,6 @@ private:
ulong m_timestamp;
ulong m_pressTimestamp;
State m_state;
- bool m_valid : 1;
bool m_accept : 1;
bool m_grabberIsHandler : 1;
int m_reserved : 29;
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 78f3b68ebb..b8131a056f 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -290,6 +290,14 @@ public:
return overThreshold;
}
+ static bool dragOverThreshold(const QQuickEventPoint *point)
+ {
+ QPointF delta = point->scenePos() - point->scenePressPos();
+ return (QQuickWindowPrivate::dragOverThreshold(delta.x(), Qt::XAxis, point) ||
+ QQuickWindowPrivate::dragOverThreshold(delta.y(), Qt::YAxis, point));
+ }
+
+
// data property
static void data_append(QQmlListProperty<QObject> *, QObject *);
static int data_count(QQmlListProperty<QObject> *);