From e1400b5b4d8311769ad3b9f631479ee2b0271197 Mon Sep 17 00:00:00 2001 From: Filippo Cucchetto Date: Thu, 14 Apr 2016 10:48:25 +0200 Subject: Fixed MouseArea threshold with preventStealing When preventStealing is true both keepMouseGrab() and d->stealMouse are true. This in turn enable the dragging immediately since the condition "keepMouseGrab() && d->stealMouse && !d->drag->active()" is true. Conversely when preventStealing is false the dragging is enabled in the next move event since keepMouseGrab() and d->stealMouse are set true inside the last "if" "!keepMouseGrab() && ...check threshold..". This patch adds a new boolean flag for storing if we detected a drag motion (so we exceeded the threshold) and enable the dragging iff this flag is true. With this change: - if preventStealing is true (and so keepMouseGrab() and d->stealMouse) the additional d->overThresHold prevent the start of dragging. At the same time the last if (!keepMouseGrab()) cannot be executed since keepMouseGrab is true and we still check for the threshold being exceeded. - if preventStealing is false, we still check for exceeding the threshold and if this happen we enter in the last "if" since !keepMousegrab() && d->overThreshold is true taking the mouseGrab as without this patch Task-number: QTBUG-52534 Change-Id: I2b14d3048b6f8223c90ce5e2fd26e7ca706cb56a Reviewed-by: Michael Brasser Reviewed-by: Robin Burchell Reviewed-by: Shawn Rutledge --- src/quick/items/qquickmousearea_p_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/quick/items/qquickmousearea_p_p.h') diff --git a/src/quick/items/qquickmousearea_p_p.h b/src/quick/items/qquickmousearea_p_p.h index 014729b651..f63c5f6092 100644 --- a/src/quick/items/qquickmousearea_p_p.h +++ b/src/quick/items/qquickmousearea_p_p.h @@ -86,6 +86,7 @@ public: bool doubleClick : 1; bool preventStealing : 1; bool propagateComposedEvents : 1; + bool overThreshold : 1; Qt::MouseButtons pressed; #ifndef QT_NO_DRAGANDDROP QQuickDrag *drag; -- cgit v1.2.3