From 8ab6ded97633bf7f74e7ca4de35ed56d07f358d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Mon, 4 Feb 2019 15:16:45 +0100 Subject: Fix bug where QQMPH kept an exclusive grab when no buttons were pressed This happened if you moved the mouse while doing a multitouch operation. More specifically this caused the bug: 1. Open qtdeclarative/tests/manual/pointer/map.qml 2. Rotate the map with two fingers (Do not release fingers). 3. Move mouse (no buttons pressed). 4. Release both fingers. 5. Move mouse again (error: the draghandler has a grab and thus the map is dragged even if no buttons are down). This happened because if you moved the mouse while having two fingers down, Windows would generate a *mouse*move* event with Left button or Right button pressed (which wasn't the case on the physical device but it's probably because of a bug in how mouse events are synthesized from touch on Windows). This caused the QQuickMultiPointHandler to do a passive grab. Then, when releasing the fingers it would not send a mouse release event (just plain touch release events), so the QQuickMultiPointHandler would keep the passive grab it had. All subsequent mouse move events would then be dispatched to the QQuickMultiPointHandler where it would assume that the button was pressed until it got a release event (but button was never pressed so that wouldn't happen). Eventually it would perform an exclusive grab, and dragging was initiated. Change-Id: I42b3133c5fde93c7f92f1cb28705156a69f9ad1c Reviewed-by: Shawn Rutledge --- .../data/draghandler_and_pinchhandler.qml | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 tests/auto/quick/pointerhandlers/qquickdraghandler/data/draghandler_and_pinchhandler.qml (limited to 'tests/auto/quick/pointerhandlers/qquickdraghandler/data/draghandler_and_pinchhandler.qml') diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/data/draghandler_and_pinchhandler.qml b/tests/auto/quick/pointerhandlers/qquickdraghandler/data/draghandler_and_pinchhandler.qml new file mode 100644 index 0000000000..08b85aef50 --- /dev/null +++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/data/draghandler_and_pinchhandler.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the manual tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.12 + +Item { + id: root + objectName: "DragHandler_and_PinchHandler" + width: 640 + height: 480 + + Rectangle { + id: rect + objectName: "Rect" + color: dragHandler.active ? "blue" : (pinchHandler.active ? "magenta" : "grey") + width: 200; height: 200; x: 100; y: 100 + + PinchHandler { + id: pinchHandler + objectName: "PinchHandler" + } + DragHandler { + id: dragHandler + objectName: "DragHandler" + } + + Text { + color: "white" + anchors.centerIn: parent + horizontalAlignment: Text.AlignHCenter + text: rect.objectName + "\n" + + "rotation:" + rect.rotation + "\n" + + dragHandler.centroid.position.x.toFixed(1) + "," + dragHandler.centroid.position.y.toFixed(1) + } + } +} -- cgit v1.2.3