aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-02-15 13:14:49 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2021-03-19 13:17:06 +0100
commitaf7e85bf55ec24492cfdee12394a7aa4e5031228 (patch)
tree4a36984a9881722464113a86ed6c9677b3241016
parent1bc7b77d7eff77b3761e543a18e4c7a795ea9f43 (diff)
Remove QQWindowPriv::is[Mouse|Touch|Tablet]Event
They are moved to QQuickDeliveryAgentPrivate. Change-Id: I5d6656dd6362dd03f0f4321cff07a8b207fadd39 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r--src/quick/handlers/qquickdraghandler.cpp4
-rw-r--r--src/quick/handlers/qquickhandlerpoint.cpp4
-rw-r--r--src/quick/handlers/qquickhoverhandler.cpp4
-rw-r--r--src/quick/handlers/qquickmultipointhandler.cpp2
-rw-r--r--src/quick/handlers/qquickpointerhandler.cpp4
-rw-r--r--src/quick/handlers/qquickpointhandler.cpp4
-rw-r--r--src/quick/handlers/qquicktaphandler.cpp7
-rw-r--r--src/quick/items/qquickflickable.cpp6
-rw-r--r--src/quick/items/qquickpathview.cpp2
-rw-r--r--src/quick/items/qquickwindow_p.h5
10 files changed, 20 insertions, 22 deletions
diff --git a/src/quick/handlers/qquickdraghandler.cpp b/src/quick/handlers/qquickdraghandler.cpp
index e5e9b03f32..d359002592 100644
--- a/src/quick/handlers/qquickdraghandler.cpp
+++ b/src/quick/handlers/qquickdraghandler.cpp
@@ -162,7 +162,7 @@ void QQuickDragHandler::onActiveChanged()
QQuickMultiPointHandler::onActiveChanged();
if (active()) {
if (auto parent = parentItem()) {
- if (QQuickWindowPrivate::isTouchEvent(currentEvent()))
+ if (QQuickDeliveryAgentPrivate::isTouchEvent(currentEvent()))
parent->setKeepTouchGrab(true);
// tablet and mouse are treated the same by Item's legacy event handling, and
// touch becomes synth-mouse for Flickable, so we need to prevent stealing
@@ -251,7 +251,7 @@ void QQuickDragHandler::handlePointerEventImpl(QPointerEvent *event)
// (That affects behavior for mouse but not for touch, because Flickable only handles mouse.)
// So we have to compensate by accepting the event here to avoid any parent Flickable from
// getting the event via direct delivery and grabbing too soon.
- point->setAccepted(QQuickWindowPrivate::isMouseEvent(event)); // stop propagation iff it's a mouse event
+ point->setAccepted(QQuickDeliveryAgentPrivate::isMouseEvent(event)); // stop propagation iff it's a mouse event
}
}
if (allOverThreshold) {
diff --git a/src/quick/handlers/qquickhandlerpoint.cpp b/src/quick/handlers/qquickhandlerpoint.cpp
index 7b804a477c..54951b82b3 100644
--- a/src/quick/handlers/qquickhandlerpoint.cpp
+++ b/src/quick/handlers/qquickhandlerpoint.cpp
@@ -110,7 +110,7 @@ void QQuickHandlerPoint::reset(const QPointerEvent *event, const QEventPoint &po
default:
break;
}
- const bool isTouch = QQuickWindowPrivate::isTouchEvent(event);
+ const bool isTouch = QQuickDeliveryAgentPrivate::isTouchEvent(event);
if (!isTouch)
m_pressedButtons = static_cast<const QSinglePointEvent *>(event)->buttons();
m_pressedModifiers = event->modifiers();
@@ -120,7 +120,7 @@ void QQuickHandlerPoint::reset(const QPointerEvent *event, const QEventPoint &po
m_pressure = point.pressure();
m_ellipseDiameters = point.ellipseDiameters();
#if QT_CONFIG(tabletevent)
- } else if (QQuickWindowPrivate::isTabletEvent(event)) {
+ } else if (QQuickDeliveryAgentPrivate::isTabletEvent(event)) {
m_uniqueId = event->pointingDevice()->uniqueId();
m_rotation = point.rotation();
m_pressure = point.pressure();
diff --git a/src/quick/handlers/qquickhoverhandler.cpp b/src/quick/handlers/qquickhoverhandler.cpp
index a22d5ddcae..b934940126 100644
--- a/src/quick/handlers/qquickhoverhandler.cpp
+++ b/src/quick/handlers/qquickhoverhandler.cpp
@@ -122,7 +122,7 @@ bool QQuickHoverHandler::wantsPointerEvent(QPointerEvent *event)
// the hovered property to transition to false prematurely.
// If a QQuickPointerTabletEvent caused the hovered property to become true,
// then only another QQuickPointerTabletEvent can make it become false.
- if (!(m_hoveredTablet && QQuickWindowPrivate::isMouseEvent(event)))
+ if (!(m_hoveredTablet && QQuickDeliveryAgentPrivate::isMouseEvent(event)))
setHovered(false);
return false;
@@ -134,7 +134,7 @@ void QQuickHoverHandler::handleEventPoint(QPointerEvent *ev, QEventPoint &point)
if (point.state() == QEventPoint::Released &&
ev->pointingDevice()->pointerType() == QPointingDevice::PointerType::Finger)
hovered = false;
- else if (QQuickWindowPrivate::isTabletEvent(ev))
+ else if (QQuickDeliveryAgentPrivate::isTabletEvent(ev))
m_hoveredTablet = true;
setHovered(hovered);
setPassiveGrab(ev, point);
diff --git a/src/quick/handlers/qquickmultipointhandler.cpp b/src/quick/handlers/qquickmultipointhandler.cpp
index 97cb958aa6..ec4fa7a18f 100644
--- a/src/quick/handlers/qquickmultipointhandler.cpp
+++ b/src/quick/handlers/qquickmultipointhandler.cpp
@@ -164,7 +164,7 @@ QVector<QEventPoint> QQuickMultiPointHandler::eligiblePoints(QPointerEvent *even
bool stealingAllowed = event->isBeginEvent() || event->isEndEvent();
for (int i = 0; i < event->pointCount(); ++i) {
auto &p = QMutableEventPoint::from(event->point(i));
- if (QQuickWindowPrivate::isMouseEvent(event)) {
+ if (QQuickDeliveryAgentPrivate::isMouseEvent(event)) {
if (static_cast<QMouseEvent *>(event)->buttons() == Qt::NoButton)
continue;
}
diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp
index f9ae620c75..c0eb00ed50 100644
--- a/src/quick/handlers/qquickpointerhandler.cpp
+++ b/src/quick/handlers/qquickpointerhandler.cpp
@@ -351,8 +351,8 @@ bool QQuickPointerHandler::approveGrabTransition(QPointerEvent *event, const QEv
allowed = true;
} else if ((d->grabPermissions & CanTakeOverFromItems)) {
QQuickItem * existingItemGrabber = qobject_cast<QQuickItem *>(event->exclusiveGrabber(point));
- if (existingItemGrabber && !((existingItemGrabber->keepMouseGrab() && QQuickWindowPrivate::isMouseEvent(event)) ||
- (existingItemGrabber->keepTouchGrab() && QQuickWindowPrivate::isTouchEvent(event)))) {
+ if (existingItemGrabber && !((existingItemGrabber->keepMouseGrab() && QQuickDeliveryAgentPrivate::isMouseEvent(event)) ||
+ (existingItemGrabber->keepTouchGrab() && QQuickDeliveryAgentPrivate::isTouchEvent(event)))) {
allowed = true;
// If the handler wants to steal the exclusive grab from an Item, the Item can usually veto
// by having its keepMouseGrab flag set. But an exception is if that Item is a parent that
diff --git a/src/quick/handlers/qquickpointhandler.cpp b/src/quick/handlers/qquickpointhandler.cpp
index 147724e5b3..3ce95db51a 100644
--- a/src/quick/handlers/qquickpointhandler.cpp
+++ b/src/quick/handlers/qquickpointhandler.cpp
@@ -140,14 +140,14 @@ void QQuickPointHandler::handleEventPoint(QPointerEvent *event, QEventPoint &poi
{
switch (point.state()) {
case QEventPoint::Pressed:
- if (QQuickWindowPrivate::isTouchEvent(event) ||
+ if (QQuickDeliveryAgentPrivate::isTouchEvent(event) ||
(static_cast<const QSinglePointEvent *>(event)->buttons() & acceptedButtons()) != Qt::NoButton) {
setPassiveGrab(event, point);
setActive(true);
}
break;
case QEventPoint::Released:
- if (QQuickWindowPrivate::isTouchEvent(event) ||
+ if (QQuickDeliveryAgentPrivate::isTouchEvent(event) ||
(static_cast<const QSinglePointEvent *>(event)->buttons() & acceptedButtons()) == Qt::NoButton)
setActive(false);
break;
diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp
index 0a7cc7e075..9ef2a138a3 100644
--- a/src/quick/handlers/qquicktaphandler.cpp
+++ b/src/quick/handlers/qquicktaphandler.cpp
@@ -99,8 +99,9 @@ QQuickTapHandler::QQuickTapHandler(QQuickItem *parent)
bool QQuickTapHandler::wantsEventPoint(const QPointerEvent *event, const QEventPoint &point)
{
- if (!QQuickWindowPrivate::isMouseEvent(event) && !QQuickWindowPrivate::isTouchEvent(event) &&
- !QQuickWindowPrivate::isTabletEvent(event))
+ if (!QQuickDeliveryAgentPrivate::isMouseEvent(event) &&
+ !QQuickDeliveryAgentPrivate::isTouchEvent(event) &&
+ !QQuickDeliveryAgentPrivate::isTabletEvent(event))
return false;
// If the user has not violated any constraint, it could be a tap.
// Otherwise we want to give up the grab so that a competing handler
@@ -154,7 +155,7 @@ void QQuickTapHandler::handleEventPoint(QPointerEvent *event, QEventPoint &point
setPressed(true, false, event, point);
break;
case QEventPoint::Released: {
- if (QQuickWindowPrivate::isTouchEvent(event) ||
+ if (QQuickDeliveryAgentPrivate::isTouchEvent(event) ||
(static_cast<const QSinglePointEvent *>(event)->buttons() & acceptedButtons()) == Qt::NoButton)
setPressed(false, false, event, point);
break;
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index b02840208d..194016f207 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -2561,9 +2561,9 @@ void QQuickFlickablePrivate::addPointerHandler(QQuickPointerHandler *h)
*/
bool QQuickFlickable::filterPointerEvent(QQuickItem *receiver, QPointerEvent *event)
{
- const bool isTouch = QQuickWindowPrivate::isTouchEvent(event);
- if (!(QQuickWindowPrivate::isMouseEvent(event) || isTouch ||
- QQuickWindowPrivate::isTabletEvent(event)))
+ const bool isTouch = QQuickDeliveryAgentPrivate::isTouchEvent(event);
+ if (!(QQuickDeliveryAgentPrivate::isMouseEvent(event) || isTouch ||
+ QQuickDeliveryAgentPrivate::isTabletEvent(event)))
return false; // don't filter hover events or wheel events, for example
Q_ASSERT_X(receiver != this, "", "Flickable received a filter event for itself");
qCDebug(lcFilter) << objectName() << "filtering" << event << "for" << receiver;
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index 4cde344dce..d862eba25b 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -1844,7 +1844,7 @@ bool QQuickPathView::childMouseEventFilter(QQuickItem *i, QEvent *e)
return QQuickItem::childMouseEventFilter(i, e);
QPointerEvent *pe = static_cast<QPointerEvent *>(e);
- if (QQuickWindowPrivate::isMouseEvent(pe)) {
+ if (QQuickDeliveryAgentPrivate::isMouseEvent(pe)) {
// The event is localized for the intended receiver (in the delegate, probably),
// but we need to look at position relative to the PathView itself.
const auto &point = pe->points().first();
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h
index 30b5a36cb5..9ecfb16840 100644
--- a/src/quick/items/qquickwindow_p.h
+++ b/src/quick/items/qquickwindow_p.h
@@ -150,10 +150,7 @@ public:
QQuickDeliveryAgentPrivate *deliveryAgentPrivate() const
{ return static_cast<QQuickDeliveryAgentPrivate *>(QQuickDeliveryAgentPrivate::get(deliveryAgent)); }
- // TODO remove these: they were moved to QQuickDeliveryAgentPrivate
- static bool isMouseEvent(const QPointerEvent *ev) { return QQuickDeliveryAgentPrivate::isMouseEvent(ev); }
- static bool isTouchEvent(const QPointerEvent *ev) { return QQuickDeliveryAgentPrivate::isTouchEvent(ev); }
- static bool isTabletEvent(const QPointerEvent *ev) { return QQuickDeliveryAgentPrivate::isTabletEvent(ev); }
+ // TODO remove this: it was moved to QQuickDeliveryAgentPrivate
void flushFrameSynchronousEvents();
#if QT_CONFIG(cursor)