aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/pointer
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-05-06 16:31:37 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2022-05-11 12:56:22 +0200
commit8068bde891eefe99a43deb83e58166b476f65225 (patch)
tree477456cdccce7346cd6c13f2d551a5593f5b7a4f /tests/manual/pointer
parent5b0bb8d78e1854f3a23d7dd0bb286f524b272c37 (diff)
QQuickFlickable: fix flicking when item is rotated
QEventPoint::velocity() is in screen coordinates, as documented; it needs to be transformed to local coordinates in case the Flickable is rotated and/or scaled. windowToItemTransform() gives us a composite transform matrix; we remove the translation components to get only the rotation and scaling. Also fix the press position calculation in handleReleaseEvent(). With the manual test one can pinch to scale and rotate a Flickable, then verify that with a single finger, the Flickable gets scrolled by an appropriate distance in spite of that. Done-with: Ivan Solovev Fixes: QTBUG-99639 Pick-to: 6.3 6.2 Change-Id: I60af1dd932835d358baa1422523cc24b2ab046a0 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/manual/pointer')
-rw-r--r--tests/manual/pointer/pinchFlickable.qml84
1 files changed, 84 insertions, 0 deletions
diff --git a/tests/manual/pointer/pinchFlickable.qml b/tests/manual/pointer/pinchFlickable.qml
new file mode 100644
index 0000000000..48a00b4b1b
--- /dev/null
+++ b/tests/manual/pointer/pinchFlickable.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 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:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick
+
+Item {
+ width: 300
+ height: 300
+
+ Flickable {
+ id: flickable
+ anchors.fill: parent
+ contentHeight: column.height
+
+ Column {
+ id: column
+ width: parent.width
+
+ Repeater {
+ model: 255
+
+ delegate: Rectangle {
+ width: column.width
+ height: 50
+ color: flickable.dragging ? "steelblue" : "gray"
+ Text {
+ anchors.centerIn: parent
+ text: index
+ }
+ }
+ }
+ }
+ }
+ PinchHandler {
+ target: flickable
+ }
+}