aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-16 08:43:08 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-07-27 10:43:04 +0000
commitf2ba3bd9792500b4d3fcfd23b03098a32641ef4f (patch)
tree5fdae298618ae42ae6e2d456bb719168377274db /src/quick
parent0e1f83dcade8cb6428513eea4452dcd500f9e486 (diff)
PointHandler: stay active as long as acceptedButtons satisfied
Ignore buttons which do not fit the acceptedButtons filter, and do not assume that it's all over when any release happens. Task-number: QTBUG-66360 Change-Id: I871ea7fdd9b76f06fa0d73382617b287c04d35ab Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/handlers/qquickhandlerpoint.cpp10
-rw-r--r--src/quick/handlers/qquickpointhandler.cpp9
-rw-r--r--src/quick/handlers/qquicksinglepointhandler.cpp14
3 files changed, 18 insertions, 15 deletions
diff --git a/src/quick/handlers/qquickhandlerpoint.cpp b/src/quick/handlers/qquickhandlerpoint.cpp
index f615829d97..00347245ee 100644
--- a/src/quick/handlers/qquickhandlerpoint.cpp
+++ b/src/quick/handlers/qquickhandlerpoint.cpp
@@ -103,16 +103,20 @@ void QQuickHandlerPoint::reset(const QQuickEventPoint *point)
switch (point->state()) {
case QQuickEventPoint::Pressed:
m_pressPosition = point->position();
+ m_scenePressPosition = point->scenePosition();
m_pressedButtons = event->buttons();
break;
case QQuickEventPoint::Released:
- reset();
- return;
+ if (event->buttons() == Qt::NoButton) {
+ reset();
+ return;
+ }
+ break;
default:
- m_pressedButtons = event->buttons();
break;
}
m_scenePressPosition = point->scenePressPosition();
+ m_pressedButtons = event->buttons();
m_pressedModifiers = event->modifiers();
if (event->asPointerTouchEvent()) {
const QQuickEventTouchPoint *tp = static_cast<const QQuickEventTouchPoint *>(point);
diff --git a/src/quick/handlers/qquickpointhandler.cpp b/src/quick/handlers/qquickpointhandler.cpp
index da19584b7a..854fadf5cf 100644
--- a/src/quick/handlers/qquickpointhandler.cpp
+++ b/src/quick/handlers/qquickpointhandler.cpp
@@ -139,11 +139,14 @@ void QQuickPointHandler::handleEventPoint(QQuickEventPoint *point)
{
switch (point->state()) {
case QQuickEventPoint::Pressed:
- setPassiveGrab(point);
- setActive(true);
+ if ((point->pointerEvent()->buttons() & acceptedButtons()) != Qt::NoButton) {
+ setPassiveGrab(point);
+ setActive(true);
+ }
break;
case QQuickEventPoint::Released:
- setActive(false);
+ if ((point->pointerEvent()->buttons() & acceptedButtons()) == Qt::NoButton)
+ setActive(false);
break;
default:
break;
diff --git a/src/quick/handlers/qquicksinglepointhandler.cpp b/src/quick/handlers/qquicksinglepointhandler.cpp
index fa08ced8e2..177ad21079 100644
--- a/src/quick/handlers/qquicksinglepointhandler.cpp
+++ b/src/quick/handlers/qquicksinglepointhandler.cpp
@@ -129,17 +129,13 @@ void QQuickSinglePointHandler::handlePointerEventImpl(QQuickPointerEvent *event)
QQuickPointerDeviceHandler::handlePointerEventImpl(event);
QQuickEventPoint *currentPoint = event->pointById(m_pointInfo.m_id);
Q_ASSERT(currentPoint);
- if (!m_pointInfo.m_id || !currentPoint->isAccepted()) {
+ m_pointInfo.reset(currentPoint);
+ handleEventPoint(currentPoint);
+ if (currentPoint->state() == QQuickEventPoint::Released && (event->buttons() & acceptedButtons()) == Qt::NoButton) {
+ setExclusiveGrab(currentPoint, false);
reset();
- } else {
- m_pointInfo.reset(currentPoint);
- handleEventPoint(currentPoint);
- if (currentPoint->state() == QQuickEventPoint::Released) {
- setExclusiveGrab(currentPoint, false);
- reset();
- }
- emit pointChanged();
}
+ emit pointChanged();
}
void QQuickSinglePointHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point)