diff options
Diffstat (limited to 'tests/auto/quick/qquickmousearea/data')
17 files changed, 192 insertions, 53 deletions
diff --git a/tests/auto/quick/qquickmousearea/data/clickThrough2.qml b/tests/auto/quick/qquickmousearea/data/clickThrough2.qml index 2624108225..4e87b4eeb5 100644 --- a/tests/auto/quick/qquickmousearea/data/clickThrough2.qml +++ b/tests/auto/quick/qquickmousearea/data/clickThrough2.qml @@ -28,8 +28,8 @@ Item{ enabled: true anchors.fill: parent propagateComposedEvents: !noPropagation - onClicked: mouse.accepted = !letThrough; - onDoubleClicked: mouse.accepted = !letThrough; - onPressAndHold: mouse.accepted = !letThrough; + onClicked: function (mouse) { mouse.accepted = !letThrough; } + onDoubleClicked: function (mouse) { mouse.accepted = !letThrough; } + onPressAndHold: function (mouse) { mouse.accepted = !letThrough; } } } diff --git a/tests/auto/quick/qquickmousearea/data/containsMouseAndHoverDisabled.qml b/tests/auto/quick/qquickmousearea/data/containsMouseAndHoverDisabled.qml new file mode 100644 index 0000000000..d98ef85c55 --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/containsMouseAndHoverDisabled.qml @@ -0,0 +1,15 @@ +import QtQuick + +Rectangle { + width: 200 + height: 200 + visible: true + MouseArea { + id: mouseArea + objectName: "mouseArea" + anchors.fill: parent + hoverEnabled: false + onPressed: function(mouse) { mouse.accepted = false } + } +} + diff --git a/tests/auto/quick/qquickmousearea/data/containsMouseMasked.qml b/tests/auto/quick/qquickmousearea/data/containsMouseMasked.qml new file mode 100644 index 0000000000..35cfd4b7ef --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/containsMouseMasked.qml @@ -0,0 +1,24 @@ +import QtQuick + +Rectangle { + width: 200 + height: 200 + visible: true + MouseArea { + id: mouseArea1 + objectName: "mouseArea1" + anchors.fill: parent + hoverEnabled: true + visible: true + } + + MouseArea { + id: mouseArea2 + objectName: "mouseArea2" + anchors.centerIn: mouseArea1 + width: 50 + height: 50 + hoverEnabled: true + visible: true + } +} diff --git a/tests/auto/quick/qquickmousearea/data/cursorUpdating.qml b/tests/auto/quick/qquickmousearea/data/cursorUpdating.qml new file mode 100644 index 0000000000..2d06543c78 --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/cursorUpdating.qml @@ -0,0 +1,71 @@ +import QtQuick + +Item { + width: 600 + height: 600 + + ListModel { + id: cursorsModel + ListElement { cursorShape: Qt.ArrowCursor; text: "Arrow" } + ListElement { cursorShape: Qt.UpArrowCursor; text: "UpArrow" } + ListElement { cursorShape: Qt.CrossCursor; text: "Cross" } + ListElement { cursorShape: Qt.WaitCursor; text: "Wait" } + ListElement { cursorShape: Qt.IBeamCursor; text: "IBeam" } + ListElement { cursorShape: Qt.SizeVerCursor; text: "SizeVer" } + ListElement { cursorShape: Qt.SizeHorCursor; text: "SizeHor" } + ListElement { cursorShape: Qt.SizeBDiagCursor; text: "SizeBDiag" } + ListElement { cursorShape: Qt.SizeFDiagCursor; text: "SizeFDiag" } + ListElement { cursorShape: Qt.SizeAllCursor; text: "SizeAll" } + ListElement { cursorShape: Qt.BlankCursor; text: "Blank" } + ListElement { cursorShape: Qt.SplitVCursor; text: "SplitV" } + ListElement { cursorShape: Qt.SplitHCursor; text: "SplitH" } + ListElement { cursorShape: Qt.PointingHandCursor; text: "PointingHand" } + ListElement { cursorShape: Qt.ForbiddenCursor; text: "Forbidden" } + ListElement { cursorShape: Qt.WhatsThisCursor; text: "WhatsThis" } + ListElement { cursorShape: Qt.BusyCursor; text: "Busy" } + ListElement { cursorShape: Qt.OpenHandCursor; text: "OpenHand" } + ListElement { cursorShape: Qt.ClosedHandCursor; text: "ClosedHand" } + ListElement { cursorShape: Qt.DragCopyCursor; text: "DragCopy" } + ListElement { cursorShape: Qt.DragMoveCursor; text: "DragMove" } + ListElement { cursorShape: Qt.DragLinkCursor; text: "DragLink" } + } + + Flickable { + anchors.fill: parent + contentHeight: flow.height + Flow { + id: flow + width: parent.width + Repeater { + model: cursorsModel + Rectangle { + id: root + color: "white" + border.width: 5 + border.color: "black" + + width: 200 + height: 200 + + Text { + id: textItem + anchors.fill: parent + anchors.margins: parent.width * 0.1 + text: model.text + fontSizeMode: Text.Fit + minimumPixelSize: 10; font.pixelSize: height + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + cursorShape: model.cursorShape + } + } + } + } + } +} diff --git a/tests/auto/quick/qquickmousearea/data/disableParentOnPress.qml b/tests/auto/quick/qquickmousearea/data/disableParentOnPress.qml new file mode 100644 index 0000000000..ddd3b5b86d --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/disableParentOnPress.qml @@ -0,0 +1,14 @@ +import QtQuick + +Rectangle { + id: whiteRect + width: 200 + height: 200 + color: ma.pressed ? "lightsteelblue" : "white" + MouseArea { + id: ma + objectName: "mousearea" + anchors.fill: parent + onPressed: parent.enabled = false + } +} diff --git a/tests/auto/quick/qquickmousearea/data/doubleClickToHide.qml b/tests/auto/quick/qquickmousearea/data/doubleClickToHide.qml new file mode 100644 index 0000000000..01f6eaabed --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/doubleClickToHide.qml @@ -0,0 +1,19 @@ +import QtQuick 2.0 + +Item { + id: root + property int clicked: 0 + property int doubleClicked: 0 + property int released: 0 + + MouseArea { + width: 200; height: 200 + onClicked: { root.clicked++ } + onDoubleClicked: { + root.doubleClicked++ + visible = false + } + onReleased: { root.released++ } + } +} + diff --git a/tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml b/tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml index 69ec8fbd47..97512d1106 100644 --- a/tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml +++ b/tests/auto/quick/qquickmousearea/data/hoverAfterPress.qml @@ -16,7 +16,7 @@ Item { objectName: "mouseArea" anchors.fill: parent hoverEnabled: true - onPressed: mouse.accepted = false + onPressed: function (mouse) { mouse.accepted = false } //onContainsMouseChanged: print("containsMouse changed =", containsMouse) Rectangle { diff --git a/tests/auto/quick/qquickmousearea/data/ignoreBySource.qml b/tests/auto/quick/qquickmousearea/data/ignoreBySource.qml index a53cbf7b1d..bb20a317f7 100644 --- a/tests/auto/quick/qquickmousearea/data/ignoreBySource.qml +++ b/tests/auto/quick/qquickmousearea/data/ignoreBySource.qml @@ -21,7 +21,7 @@ Item { MouseArea { id: ma objectName: "mousearea" - onPressed: { + onPressed: function (mouse) { root.lastEventSource = mouse.source if (mouse.source !== root.allowedSource) mouse.accepted = false diff --git a/tests/auto/quick/qquickmousearea/data/mask.qml b/tests/auto/quick/qquickmousearea/data/mask.qml index ec315c2a63..ab8ecbf32d 100644 --- a/tests/auto/quick/qquickmousearea/data/mask.qml +++ b/tests/auto/quick/qquickmousearea/data/mask.qml @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 Ford Motor Company -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** 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-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 Ford Motor Company +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only import QtQuick 2.11 import Test 1.0 diff --git a/tests/auto/quick/qquickmousearea/data/moveAndReleaseWithoutPress.qml b/tests/auto/quick/qquickmousearea/data/moveAndReleaseWithoutPress.qml index 6c68f0c7c8..4b7324a98a 100644 --- a/tests/auto/quick/qquickmousearea/data/moveAndReleaseWithoutPress.qml +++ b/tests/auto/quick/qquickmousearea/data/moveAndReleaseWithoutPress.qml @@ -7,7 +7,7 @@ MouseArea { property bool hadMove: false property bool hadRelease: false - onPressed: mouse.accepted = false + onPressed: function (mouse) { mouse.accepted = false } onPositionChanged: hadMove = true onReleased: hadRelease = true } diff --git a/tests/auto/quick/qquickmousearea/data/preventStealingListViewChild.qml b/tests/auto/quick/qquickmousearea/data/preventStealingListViewChild.qml new file mode 100644 index 0000000000..3833c5a8a9 --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/preventStealingListViewChild.qml @@ -0,0 +1,31 @@ +import QtQuick 2.15 + +ListView { + id: flick + width: 640 + height: 480 + model: 100 + + delegate: Rectangle { + border.color: "#81e889" + width: 640; height: 100 + Text { text: "Row " + index } + } + + Rectangle { + anchors.right: parent.right + anchors.margins: 2 + color: ma.pressed ? "#81e889" : "#c2f4c6" + width: 50; height: 50 + radius: 5 + MouseArea { + id: ma + anchors.fill: parent + preventStealing: true + drag { + target: parent + axis: Drag.YAxis + } + } + } +} diff --git a/tests/auto/quick/qquickmousearea/data/qtbug34368.qml b/tests/auto/quick/qquickmousearea/data/qtbug34368.qml index 42d8ddd3b6..96e72a8edc 100644 --- a/tests/auto/quick/qquickmousearea/data/qtbug34368.qml +++ b/tests/auto/quick/qquickmousearea/data/qtbug34368.qml @@ -12,7 +12,7 @@ Rectangle { anchors.fill: parent propagateComposedEvents: true z: 1 - onClicked: { + onClicked: function (mouse) { mouse.accepted = false; clicksEnabled += 1; //console.log("Upper click"); @@ -23,7 +23,7 @@ Rectangle { propagateComposedEvents: true z: 0 enabled: !disableLower - onClicked: { + onClicked: function (mouse) { mouse.accepted = false; clicksDisabled += 1; //console.log("Lower click"); diff --git a/tests/auto/quick/qquickmousearea/data/qtbug49100.qml b/tests/auto/quick/qquickmousearea/data/qtbug49100.qml index 39b293c8fa..d3dfe64d94 100644 --- a/tests/auto/quick/qquickmousearea/data/qtbug49100.qml +++ b/tests/auto/quick/qquickmousearea/data/qtbug49100.qml @@ -8,7 +8,7 @@ ListView { delegate: Text { text: index + 1 height: 30 - width: parent.width + width: ListView.view.width MouseArea { anchors.fill: parent } diff --git a/tests/auto/quick/qquickmousearea/data/rejectEvent.qml b/tests/auto/quick/qquickmousearea/data/rejectEvent.qml index 48b68ee845..03a075300a 100644 --- a/tests/auto/quick/qquickmousearea/data/rejectEvent.qml +++ b/tests/auto/quick/qquickmousearea/data/rejectEvent.qml @@ -23,7 +23,7 @@ Rectangle { id: mouseRegion2 objectName: "mouseRegion2" width: 120; height: 120 - onPressed: { root.mr2_pressed = true; mouse.accepted = false } + onPressed: function (mouse) { root.mr2_pressed = true; mouse.accepted = false } onReleased: { root.mr2_released = true } onCanceled: { root.mr2_canceled = true } } diff --git a/tests/auto/quick/qquickmousearea/data/simple.qml b/tests/auto/quick/qquickmousearea/data/simple.qml index 56d561e5af..2b8a2af118 100644 --- a/tests/auto/quick/qquickmousearea/data/simple.qml +++ b/tests/auto/quick/qquickmousearea/data/simple.qml @@ -4,8 +4,9 @@ Rectangle { id: whiteRect width: 200 height: 200 - color: "white" + color: ma.pressed ? "lightsteelblue" : "white" MouseArea { + id: ma objectName: "mousearea" anchors.fill: parent } diff --git a/tests/auto/quick/qquickmousearea/data/updateMousePosOnResize.qml b/tests/auto/quick/qquickmousearea/data/updateMousePosOnResize.qml index 55af864060..a20f752864 100644 --- a/tests/auto/quick/qquickmousearea/data/updateMousePosOnResize.qml +++ b/tests/auto/quick/qquickmousearea/data/updateMousePosOnResize.qml @@ -22,19 +22,19 @@ Rectangle { property bool mouseMatchesPos: true anchors.fill: brother - onPressed: { + onPressed: function (mouse) { if (mouse.x != mouseX || mouse.y != mouseY) mouseMatchesPos = false x1 = mouseX; y1 = mouseY anchors.fill = parent } onPositionChanged: { emitPositionChanged = true } - onMouseXChanged: { + onMouseXChanged: function (mouse) { if (mouse.x != mouseX || mouse.y != mouseY) mouseMatchesPos = false x2 = mouseX; y2 = mouseY } - onMouseYChanged: { + onMouseYChanged: function (mouse) { if (mouse.x != mouseX || mouse.y != mouseY) mouseMatchesPos = false x2 = mouseX; y2 = mouseY diff --git a/tests/auto/quick/qquickmousearea/data/wheel.qml b/tests/auto/quick/qquickmousearea/data/wheel.qml index 3e0c0c2a48..6cd367b22f 100644 --- a/tests/auto/quick/qquickmousearea/data/wheel.qml +++ b/tests/auto/quick/qquickmousearea/data/wheel.qml @@ -14,7 +14,7 @@ Rectangle { MouseArea { anchors.fill: parent - onWheel: { + onWheel: function (wheel) { root.angleDeltaY = wheel.angleDelta.y; root.mouseX = wheel.x; root.mouseY = wheel.y; |