diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-09-06 21:40:18 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-09-24 17:03:19 +0200 |
commit | 8503f884bbdb50c4bebc8f8a9fce05275b0612b1 (patch) | |
tree | c4a28a0df334841a49d6653ffd02c38aca54b68a | |
parent | 11b358a82cd4b1570f32c53808ef974bf11ffb9d (diff) |
Move most of the pointer manual tests to a new pointerhandlers example
They were always meant to be examples eventually. Now they will be used
for an example of how to implement custom controls using only basic
items and handlers. Some components are very similar to those in
the shared directory; but most examples will use Qt Quick Controls,
so those shared components can be removed when we no longer use them.
This example should remain as the one that shows how to build
reusable controls "from scratch".
Removed InputInspector because it's inefficient, has limited usefulness,
tends to require building the manual test to be able to run it, and
could be better built as a reusable Qt.labs component later on,
providing a model with all known devices and taking advantage of the
QPointingDevice::grabChanged signal to track the grab states rather
than polling.
Pick-to: 6.2
Change-Id: I47ab6ebb2cecab07a69cf96e546ffd0db3026a60
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
56 files changed, 1581 insertions, 966 deletions
diff --git a/examples/quick/CMakeLists.txt b/examples/quick/CMakeLists.txt index 0f09789859..bf9c06e3c7 100644 --- a/examples/quick/CMakeLists.txt +++ b/examples/quick/CMakeLists.txt @@ -53,6 +53,7 @@ set(reused_dir_targets shapes_shared imageelements_shared delegatechooser_shared + pointerhandlers_shared ) foreach(target IN LISTS reused_dir_targets) if(TARGET ${target}) diff --git a/examples/quick/pointerhandlers/CMakeLists.txt b/examples/quick/pointerhandlers/CMakeLists.txt new file mode 100644 index 0000000000..ca378d49e1 --- /dev/null +++ b/examples/quick/pointerhandlers/CMakeLists.txt @@ -0,0 +1,84 @@ +# Generated from pointer.pro. + +cmake_minimum_required(VERSION 3.16) +project(pointerhandlers LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/pointerhandlers") + +find_package(Qt6 COMPONENTS Core Gui Quick Qml Svg) + +add_subdirectory("../shared" "shared") + +qt_add_executable(pointerhandlersexample WIN32 MACOSX_BUNDLE main.cpp) + +target_link_libraries(pointerhandlersexample PUBLIC + Qt::Core + Qt::Gui + Qt::Qml + Qt::Quick + Qt::Svg + pointerhandlers_shared +) + +qt_add_qml_module(pointerhandlersexample + URI pointerhandlers + VERSION 1.0 + QML_FILES + "components/Button.qml" + "components/CheckBox.qml" + "components/FakeFlickable.qml" + "components/FlashAnimation.qml" + "components/LeftDrawer.qml" + "components/MomentumAnimation.qml" + "components/MouseFeedbackSprite.qml" + "components/ScrollBar.qml" + "components/Slider.qml" + "components/TouchpointFeedbackSprite.qml" + "fakeFlickable.qml" + "flingAnimation.qml" + "joystick.qml" + "map.qml" + "mixer.qml" + "multibuttons.qml" + "pinchHandler.qml" + "pointerhandlers.qml" + "sidebar.qml" + "singlePointHandlerProperties.qml" + "tabletCanvasDrawing.qml" + "tapHandler.qml" + RESOURCES + "components/images/checkmark.png" + "components/images/fingersprite.png" + "components/images/mixer-knob.png" + "components/images/mouse.png" + "components/images/mouse_left.png" + "components/images/mouse_middle.png" + "components/images/mouse_right.png" + "images/arrowhead.png" + "images/balloon.png" + "images/cursor-airbrush.png" + "images/cursor-eraser.png" + "images/cursor-felt-marker.png" + "images/cursor-pencil.png" + "images/fighter.png" + "images/grabbing-location.svg" + "images/joystick-outer-case-pov.jpg" + "images/map.svgz" + "images/missile.png" + "images/redball.png" +) + +install(TARGETS pointerhandlersexample + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) +bundle_shared(pointerhandlersexample) diff --git a/examples/quick/pointerhandlers/components/Button.qml b/examples/quick/pointerhandlers/components/Button.qml new file mode 100644 index 0000000000..9ff3870d7b --- /dev/null +++ b/examples/quick/pointerhandlers/components/Button.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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 + +Rectangle { + id: root + property alias label: label + property alias text: label.text + property alias pressed: tap.pressed + property alias hovered: hoverHandler.hovered + property alias gesturePolicy: tap.gesturePolicy + property alias margin: tap.margin + signal tapped + + implicitHeight: Math.max(Screen.pixelDensity * 7, label.implicitHeight * 2) + implicitWidth: Math.max(Screen.pixelDensity * 11, label.implicitWidth * 1.3) + height: implicitHeight + width: implicitWidth + radius: height / 6 + + border { color: Qt.darker(palette.button, 1.5); width: 1 } + gradient: Gradient { + GradientStop { position: 0.0; color: tap.pressed ? Qt.darker(palette.button, 1.3) : palette.button } + GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) } + } + + TapHandler { + id: tap + margin: 10 // the user can tap a little beyond the edges + objectName: label.text + " Tap" + onTapped: { + tapFlash.start() + root.tapped() + } + } + HoverHandler { + id: hoverHandler + } + + Text { + id: label + font.pointSize: 14 + color: palette.buttonText + text: "Button" + anchors.centerIn: parent + } + + Rectangle { + anchors.fill: parent + color: "transparent" + border.width: 2; radius: root.radius; antialiasing: true + opacity: tapFlash.running ? 1 : 0 + FlashAnimation on visible { + id: tapFlash + } + } +} diff --git a/examples/quick/pointerhandlers/components/CheckBox.qml b/examples/quick/pointerhandlers/components/CheckBox.qml new file mode 100644 index 0000000000..bcd9ad99db --- /dev/null +++ b/examples/quick/pointerhandlers/components/CheckBox.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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 { + id: root + implicitHeight: frame.height + implicitWidth: row.implicitWidth + width: implicitWidth + height: implicitHeight + property alias text: label.text + property bool checked + + property alias pressed: tapHandler.pressed + property alias row: row + signal clicked + + Row { + id: row + anchors.verticalCenter: parent.verticalCenter + spacing: 6 + Rectangle { + id: frame + gradient: Gradient { + GradientStop { position: 0.0; color: tapHandler.pressed ? Qt.darker(palette.button, 1.3) : palette.button } + GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) } + } + height: label.implicitHeight * 1.5 + width: height + anchors.margins: 1 + radius: 3 + antialiasing: true + border.color: Qt.darker(palette.button, 1.5) + Image { + id: theX + source: "images/checkmark.png" + anchors.fill: frame + anchors.margins: frame.width / 5 + fillMode: Image.PreserveAspectFit + smooth: true + visible: root.checked + } + } + Text { + id: label + color: palette.text + anchors.verticalCenter: frame.verticalCenter + } + } + TapHandler { + id: tapHandler + onTapped: { + parent.checked = !parent.checked + parent.clicked() + } + } +} diff --git a/tests/manual/pointer/content/FakeFlickable.qml b/examples/quick/pointerhandlers/components/FakeFlickable.qml index 636399ba2c..2857d066aa 100644 --- a/tests/manual/pointer/content/FakeFlickable.qml +++ b/examples/quick/pointerhandlers/components/FakeFlickable.qml @@ -1,11 +1,11 @@ /**************************************************************************** ** -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $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 @@ -14,13 +14,35 @@ ** 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. +** 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$ ** diff --git a/examples/quick/pointerhandlers/components/FlashAnimation.qml b/examples/quick/pointerhandlers/components/FlashAnimation.qml new file mode 100644 index 0000000000..047112d22c --- /dev/null +++ b/examples/quick/pointerhandlers/components/FlashAnimation.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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 2.12 + +SequentialAnimation { + id: tapFlash + running: false + PropertyAction { value: false } + PauseAnimation { duration: 100 } + PropertyAction { value: true } + PauseAnimation { duration: 100 } + PropertyAction { value: false } + PauseAnimation { duration: 100 } + PropertyAction { value: true } + PauseAnimation { duration: 100 } + PropertyAction { value: false } + PauseAnimation { duration: 100 } + PropertyAction { value: true } +} diff --git a/tests/manual/pointer/content/LeftDrawer.qml b/examples/quick/pointerhandlers/components/LeftDrawer.qml index 7e43e5a2bd..5cf1420519 100644 --- a/tests/manual/pointer/content/LeftDrawer.qml +++ b/examples/quick/pointerhandlers/components/LeftDrawer.qml @@ -3,9 +3,9 @@ ** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $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 @@ -14,13 +14,35 @@ ** 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. +** 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$ ** diff --git a/examples/quick/pointerhandlers/components/MomentumAnimation.qml b/examples/quick/pointerhandlers/components/MomentumAnimation.qml new file mode 100644 index 0000000000..03e1689317 --- /dev/null +++ b/examples/quick/pointerhandlers/components/MomentumAnimation.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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 2.12 + +ParallelAnimation { + id: root + property Item target: null + property int duration: 500 + property vector2d velocity: Qt.vector2d(0,0) + + function restart(vel) { + stop() + velocity = vel + start() + } + + NumberAnimation { + id: xAnim + target: root.target + property: "x" + to: target.x + velocity.x / duration * 100 + duration: root.duration + easing.type: Easing.OutQuad + } + NumberAnimation { + id: yAnim + target: root.target + property: "y" + to: target.y + velocity.y / duration * 100 + duration: root.duration + easing.type: Easing.OutQuad + } +} diff --git a/tests/manual/pointer/content/MouseFeedbackSprite.qml b/examples/quick/pointerhandlers/components/MouseFeedbackSprite.qml index d3068ff503..4d6f1843c8 100644 --- a/tests/manual/pointer/content/MouseFeedbackSprite.qml +++ b/examples/quick/pointerhandlers/components/MouseFeedbackSprite.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage @@ -57,21 +57,21 @@ PointHandler { acceptedButtons: Qt.AllButtons target: Image { objectName: "mouse sprite" - source: "../resources/mouse.png" + source: "images/mouse.png" visible: handler.active x: handler.point.position.x - width / 2 y: handler.point.position.y - height / 2 parent: handler.parent Image { - source: "../resources/mouse_left.png" + source: "images/mouse_left.png" visible: handler.point.pressedButtons & Qt.LeftButton } Image { - source: "../resources/mouse_middle.png" + source: "images/mouse_middle.png" visible: handler.point.pressedButtons & Qt.MiddleButton } Image { - source: "../resources/mouse_right.png" + source: "images/mouse_right.png" visible: handler.point.pressedButtons & Qt.RightButton } } diff --git a/tests/manual/pointer/content/ScrollBar.qml b/examples/quick/pointerhandlers/components/ScrollBar.qml index 9928433d1f..f5cf27a0c5 100644 --- a/tests/manual/pointer/content/ScrollBar.qml +++ b/examples/quick/pointerhandlers/components/ScrollBar.qml @@ -1,11 +1,11 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $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 @@ -14,13 +14,35 @@ ** 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. +** 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$ ** @@ -41,8 +63,6 @@ Rectangle { flick.contentY = position * knob.scrollDistance } - SystemPalette { id: palette } - color: palette.button border.color: Qt.darker(palette.button, 1.5) gradient: Gradient { diff --git a/examples/quick/pointerhandlers/components/Slider.qml b/examples/quick/pointerhandlers/components/Slider.qml new file mode 100644 index 0000000000..0365d01149 --- /dev/null +++ b/examples/quick/pointerhandlers/components/Slider.qml @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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 +import Qt.labs.animation + +Item { + id: root + property int value: 50 + property int maximumValue: 99 + property alias label: label.text + property alias tapEnabled: tap.enabled + property alias pressed: tap.pressed + signal tapped + + DragHandler { + id: dragHandler + objectName: label.text + " DragHandler" + target: knob + xAxis.enabled: false + } + + WheelHandler { + id: wheelHandler + objectName: label.text + " WheelHandler" + acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad + invertible: false // Don't let the system "natural scrolling" setting affect this + rotationScale: -0.5 // But make it go consistently in the same direction as the fingers or wheel, a bit slow + target: knob + property: "y" + } + + Rectangle { + id: slot + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.margins: 10 + anchors.topMargin: label.height + 6 + anchors.bottomMargin: valueLabel.height + 4 + anchors.horizontalCenter: parent.horizontalCenter + width: 10 + color: "black" + radius: width / 2 + smooth: true + } + + Rectangle { + // RectangularGlow is better, but that's a different module + id: glow + anchors.fill: knob + anchors.margins: -5 + anchors.leftMargin: -2 + anchors.horizontalCenterOffset: 1 + radius: 5 + color: "#4400FFFF" + opacity: tap.pressed || tapFlash.running ? 1 : 0 + FlashAnimation on visible { + id: tapFlash + } + } + Image { + id: knob + source: "images/mixer-knob.png" + antialiasing: true + x: slot.x - width / 2 + slot.width / 2 + height: root.width / 2 + width: implicitWidth / implicitHeight * height + property bool programmatic: false + property real multiplier: root.maximumValue / (ybr.maximum - ybr.minimum) + onYChanged: if (!programmatic) root.value = root.maximumValue - (knob.y - ybr.minimum) * multiplier + transformOrigin: Item.Center + function setValue(value) { knob.y = ybr.maximum - value / knob.multiplier } + TapHandler { + id: tap + objectName: label.text + " TapHandler" + gesturePolicy: TapHandler.DragThreshold + onTapped: { + tapFlash.start() + root.tapped + } + } + BoundaryRule on y { + id: ybr + minimum: slot.y + maximum: slot.height + slot.y - knob.height + } + } + + Text { + id: valueLabel + font.pointSize: 16 + color: "red" + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + text: root.value + } + + Text { + id: label + font.pointSize: 12 + color: "red" + anchors.top: parent.top + anchors.topMargin: 5 + anchors.horizontalCenter: parent.horizontalCenter + } + + onHeightChanged: { + knob.programmatic = true + knob.setValue(root.value) + knob.programmatic = false + } +} diff --git a/examples/quick/pointerhandlers/components/TouchpointFeedbackSprite.qml b/examples/quick/pointerhandlers/components/TouchpointFeedbackSprite.qml new file mode 100644 index 0000000000..5a4f258b8c --- /dev/null +++ b/examples/quick/pointerhandlers/components/TouchpointFeedbackSprite.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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 2.12 + +PointHandler { + id: handler + objectName: "point " + handler.point.id.toString(16) + acceptedDevices: PointerDevice.TouchScreen | PointerDevice.TouchPad + target: AnimatedSprite { + objectName: "sprite " + handler.point.id.toString(16) + source: "images/fingersprite.png" + visible: handler.active + running: visible // QTBUG-64544: running defaults to true, but we don't see it animating if we don't toggle it like this + x: handler.point.position.x - 20 + y: handler.point.position.y - 13 + width: frameWidth + height: frameHeight + frameWidth: 43 + frameHeight: 64 + frameCount: 3 + frameRate: 5 + parent: handler.parent + } +} diff --git a/examples/quick/pointerhandlers/components/images/checkmark.png b/examples/quick/pointerhandlers/components/images/checkmark.png Binary files differnew file mode 100644 index 0000000000..821aafccdd --- /dev/null +++ b/examples/quick/pointerhandlers/components/images/checkmark.png diff --git a/examples/quick/pointerhandlers/components/images/fingersprite.png b/examples/quick/pointerhandlers/components/images/fingersprite.png Binary files differnew file mode 100644 index 0000000000..423d115fdf --- /dev/null +++ b/examples/quick/pointerhandlers/components/images/fingersprite.png diff --git a/examples/quick/pointerhandlers/components/images/mixer-knob.png b/examples/quick/pointerhandlers/components/images/mixer-knob.png Binary files differnew file mode 100644 index 0000000000..b7d42ee3bd --- /dev/null +++ b/examples/quick/pointerhandlers/components/images/mixer-knob.png diff --git a/tests/manual/pointer/resources/mouse.png b/examples/quick/pointerhandlers/components/images/mouse.png Binary files differindex 268946df0a..268946df0a 100644 --- a/tests/manual/pointer/resources/mouse.png +++ b/examples/quick/pointerhandlers/components/images/mouse.png diff --git a/tests/manual/pointer/resources/mouse_left.png b/examples/quick/pointerhandlers/components/images/mouse_left.png Binary files differindex 9292301b47..9292301b47 100644 --- a/tests/manual/pointer/resources/mouse_left.png +++ b/examples/quick/pointerhandlers/components/images/mouse_left.png diff --git a/tests/manual/pointer/resources/mouse_middle.png b/examples/quick/pointerhandlers/components/images/mouse_middle.png Binary files differindex 064e8b9c16..064e8b9c16 100644 --- a/tests/manual/pointer/resources/mouse_middle.png +++ b/examples/quick/pointerhandlers/components/images/mouse_middle.png diff --git a/tests/manual/pointer/resources/mouse_right.png b/examples/quick/pointerhandlers/components/images/mouse_right.png Binary files differindex cab1a36ba6..cab1a36ba6 100644 --- a/tests/manual/pointer/resources/mouse_right.png +++ b/examples/quick/pointerhandlers/components/images/mouse_right.png diff --git a/tests/manual/pointer/fakeFlickable.qml b/examples/quick/pointerhandlers/fakeFlickable.qml index be52e4dbaa..b6be729e3c 100644 --- a/tests/manual/pointer/fakeFlickable.qml +++ b/examples/quick/pointerhandlers/fakeFlickable.qml @@ -1,11 +1,11 @@ /**************************************************************************** ** -** Copyright (C) 2019 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $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 @@ -14,20 +14,42 @@ ** 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. +** 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 2.12 -import "content" +import "components" Rectangle { id: root @@ -61,7 +83,7 @@ Rectangle { Component.onCompleted: { var request = new XMLHttpRequest() - request.open('GET', 'content/FakeFlickable.qml') + request.open('GET', 'components/FakeFlickable.qml') request.onreadystatechange = function(event) { if (request.readyState === XMLHttpRequest.DONE) text.text = request.responseText diff --git a/tests/manual/pointer/flingAnimation.qml b/examples/quick/pointerhandlers/flingAnimation.qml index 4ec84789cd..a2a6a0acd1 100644 --- a/tests/manual/pointer/flingAnimation.qml +++ b/examples/quick/pointerhandlers/flingAnimation.qml @@ -1,11 +1,11 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $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 @@ -14,20 +14,42 @@ ** 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. +** 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 2.12 -import "content" +import "components" Rectangle { id: root @@ -41,7 +63,7 @@ Rectangle { Image { id: ball objectName: "ball" + index - source: "resources/redball.png" + source: "images/redball.png" property real homeX: 200 + index * 200 property real homeY: 200 width: 80; height: 80; x: homeX; y: 200 @@ -113,7 +135,7 @@ Rectangle { antialiasing: true Image { - source: "resources/arrowhead.png" + source: "images/arrowhead.png" anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter width: 16 diff --git a/tests/manual/pointer/resources/arrowhead.png b/examples/quick/pointerhandlers/images/arrowhead.png Binary files differindex 7719bc6d6a..7719bc6d6a 100644 --- a/tests/manual/pointer/resources/arrowhead.png +++ b/examples/quick/pointerhandlers/images/arrowhead.png diff --git a/tests/manual/pointer/resources/balloon.png b/examples/quick/pointerhandlers/images/balloon.png Binary files differindex 6476facc49..6476facc49 100644 --- a/tests/manual/pointer/resources/balloon.png +++ b/examples/quick/pointerhandlers/images/balloon.png diff --git a/tests/manual/pointer/resources/cursor-airbrush.png b/examples/quick/pointerhandlers/images/cursor-airbrush.png Binary files differindex bea756ed6f..bea756ed6f 100644 --- a/tests/manual/pointer/resources/cursor-airbrush.png +++ b/examples/quick/pointerhandlers/images/cursor-airbrush.png diff --git a/tests/manual/pointer/resources/cursor-eraser.png b/examples/quick/pointerhandlers/images/cursor-eraser.png Binary files differindex e5488a89f2..e5488a89f2 100644 --- a/tests/manual/pointer/resources/cursor-eraser.png +++ b/examples/quick/pointerhandlers/images/cursor-eraser.png diff --git a/tests/manual/pointer/resources/cursor-felt-marker.png b/examples/quick/pointerhandlers/images/cursor-felt-marker.png Binary files differindex 132f09aa39..132f09aa39 100644 --- a/tests/manual/pointer/resources/cursor-felt-marker.png +++ b/examples/quick/pointerhandlers/images/cursor-felt-marker.png diff --git a/tests/manual/pointer/resources/cursor-pencil.png b/examples/quick/pointerhandlers/images/cursor-pencil.png Binary files differindex cc2f447d02..cc2f447d02 100644 --- a/tests/manual/pointer/resources/cursor-pencil.png +++ b/examples/quick/pointerhandlers/images/cursor-pencil.png diff --git a/tests/manual/pointer/resources/fighter.png b/examples/quick/pointerhandlers/images/fighter.png Binary files differindex 2acee43cba..2acee43cba 100644 --- a/tests/manual/pointer/resources/fighter.png +++ b/examples/quick/pointerhandlers/images/fighter.png diff --git a/tests/manual/pointer/resources/grabbing-location.svg b/examples/quick/pointerhandlers/images/grabbing-location.svg index c26881e9ba..c26881e9ba 100644 --- a/tests/manual/pointer/resources/grabbing-location.svg +++ b/examples/quick/pointerhandlers/images/grabbing-location.svg diff --git a/tests/manual/pointer/resources/joystick-outer-case-pov.jpg b/examples/quick/pointerhandlers/images/joystick-outer-case-pov.jpg Binary files differindex 01cd78fdcf..01cd78fdcf 100644 --- a/tests/manual/pointer/resources/joystick-outer-case-pov.jpg +++ b/examples/quick/pointerhandlers/images/joystick-outer-case-pov.jpg diff --git a/examples/quick/pointerhandlers/images/map.svgz b/examples/quick/pointerhandlers/images/map.svgz Binary files differnew file mode 100644 index 0000000000..64d509c106 --- /dev/null +++ b/examples/quick/pointerhandlers/images/map.svgz diff --git a/tests/manual/pointer/resources/missile.png b/examples/quick/pointerhandlers/images/missile.png Binary files differindex 72c02d1fb9..72c02d1fb9 100644 --- a/tests/manual/pointer/resources/missile.png +++ b/examples/quick/pointerhandlers/images/missile.png diff --git a/tests/manual/pointer/resources/redball.png b/examples/quick/pointerhandlers/images/redball.png Binary files differindex 68d2e1d638..68d2e1d638 100644 --- a/tests/manual/pointer/resources/redball.png +++ b/examples/quick/pointerhandlers/images/redball.png diff --git a/tests/manual/pointer/joystick.qml b/examples/quick/pointerhandlers/joystick.qml index c8880f9100..c0445a5e21 100644 --- a/tests/manual/pointer/joystick.qml +++ b/examples/quick/pointerhandlers/joystick.qml @@ -1,11 +1,11 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $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 @@ -14,13 +14,35 @@ ** 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. +** 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$ ** @@ -33,12 +55,12 @@ Item { Image { id: image anchors.centerIn: parent - source: "resources/joystick-outer-case-pov.jpg" + source: "images/joystick-outer-case-pov.jpg" property real margin: 50 Image { id: knob - source: "resources/redball.png" + source: "images/redball.png" DragHandler { id: dragHandler xAxis { diff --git a/examples/quick/pointerhandlers/main.cpp b/examples/quick/pointerhandlers/main.cpp new file mode 100644 index 0000000000..c2c98b96d6 --- /dev/null +++ b/examples/quick/pointerhandlers/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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$ +** +****************************************************************************/ +#include "../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(pointerhandlers/pointerhandlers) diff --git a/tests/manual/pointer/map.qml b/examples/quick/pointerhandlers/map.qml index a45443f562..f54319f8aa 100644 --- a/tests/manual/pointer/map.qml +++ b/examples/quick/pointerhandlers/map.qml @@ -3,9 +3,9 @@ ** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $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 @@ -14,13 +14,35 @@ ** 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. +** 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$ ** @@ -51,7 +73,9 @@ Item { id: wheelHandler objectName: "vertical mouse wheel for scaling" property: "scale" - onWheel: console.log("rotation " + event.angleDelta + " scaled " + rotation + " @ " + point.position + " => " + map.scale) + onWheel: function(event) { + console.log("rotation " + event.angleDelta + " scaled " + rotation + " @ " + point.position + " => " + map.scale) + } } WheelHandler { @@ -65,7 +89,7 @@ Item { id: image anchors.centerIn: parent fillMode: Image.PreserveAspectFit - source: "resources/map.svgz" + source: "images/map.svgz" Component.onCompleted: { width = implicitWidth; height = implicitHeight } } diff --git a/examples/quick/pointerhandlers/mixer.qml b/examples/quick/pointerhandlers/mixer.qml new file mode 100644 index 0000000000..39cc2974d7 --- /dev/null +++ b/examples/quick/pointerhandlers/mixer.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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 2.12 +import "components" + +Rectangle { + id: root + width: 1280 + height: 960 + objectName: "root" + color: "#222222" + + ListView { + id: list + objectName: "listView" + anchors.fill: parent + anchors.margins: 10 + orientation: Qt.Horizontal + + model: 20 + + delegate: Item { + objectName: "delegateItem" + index + width: 154 + height: list.height + + Slider { + anchors.fill: parent + label: "Channel " + (index + 1) + } + } + } +} diff --git a/examples/quick/pointerhandlers/multibuttons.qml b/examples/quick/pointerhandlers/multibuttons.qml new file mode 100644 index 0000000000..a3a4e21771 --- /dev/null +++ b/examples/quick/pointerhandlers/multibuttons.qml @@ -0,0 +1,118 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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 +import QtQuick.Particles +import QtQuick.Layouts +import "components" + +Item { + width: 800 + height: 800 + ColumnLayout { + anchors.right: parent.right + anchors.margins: 20 + spacing: 20 + Text { text: "protagonist"; font.pointSize: 12; font.weight: Font.Bold; bottomPadding: -10 } + Button { + id: balloonsButton + text: "Launch Balloons" + Layout.fillWidth: true + gesturePolicy: TapHandler.WithinBounds + Text { + anchors { top: parent.bottom; horizontalCenter: parent.horizontalCenter } + text: "gesturePolicy: WithinBounds" + } + } + Text { text: "the goons"; font.pointSize: 12; font.weight: Font.Bold; bottomPadding: -10 } + Button { + id: missilesButton + text: "Launch Missile" + Layout.fillWidth: true + gesturePolicy: TapHandler.ReleaseWithinBounds + onTapped: missileEmitter.burst(1) + Text { + anchors { top: parent.bottom; horizontalCenter: parent.horizontalCenter } + text: "gesturePolicy: ReleaseWithinBounds" + } + } + Button { + id: fightersButton + text: "Launch Fighters" + Layout.fillWidth: true + gesturePolicy: TapHandler.DragThreshold + Text { + anchors { top: parent.bottom; horizontalCenter: parent.horizontalCenter } + text: "gesturePolicy: DragThreshold" + } + } + } + ParticleSystem { + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.leftMargin: 150 + ImageParticle { source: "images/balloon.png" } + Emitter { anchors.bottom: parent.bottom; enabled: balloonsButton.pressed; lifeSpan: 5000; size: 64 + maximumEmitted: 99 + emitRate: 50; velocity: PointDirection { x: 10; y: -150; yVariation: 30; xVariation: 50 } } } + ParticleSystem { + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + ImageParticle { source: "images/fighter.png" } + Emitter { anchors.bottom: parent.bottom; enabled: fightersButton.pressed; lifeSpan: 15000; size: 204 + emitRate: 3; velocity: PointDirection { x: -1000; y: -250; yVariation: 150; xVariation: 50 } } } + ParticleSystem { + anchors.bottom: parent.bottom + anchors.right: parent.right + anchors.rightMargin: 100 + ImageParticle { source: "images/missile.png"; autoRotation: true; rotation: 90 } + Emitter { id: missileEmitter; anchors.bottom: parent.bottom; lifeSpan: 5000; size: 128; + emitRate: 0; velocity: PointDirection { x: -200; y: -350; yVariation: 200; xVariation: 100 } } } +} diff --git a/tests/manual/pointer/pinchHandler.qml b/examples/quick/pointerhandlers/pinchHandler.qml index e7f4530c4c..a4477b0af0 100644 --- a/tests/manual/pointer/pinchHandler.qml +++ b/examples/quick/pointerhandlers/pinchHandler.qml @@ -1,11 +1,11 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $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 @@ -14,20 +14,42 @@ ** 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. +** 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 2.12 -import "content" +import "components" Rectangle { width: 1024; height: 600 diff --git a/examples/quick/pointerhandlers/pointerhandlers.qml b/examples/quick/pointerhandlers/pointerhandlers.qml new file mode 100644 index 0000000000..ba3eb27132 --- /dev/null +++ b/examples/quick/pointerhandlers/pointerhandlers.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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 +import QtQuick.Layouts +import shared as Examples +import "components" + +Rectangle { + id: window + width: 800 + height: 800 + visible: true + Examples.LauncherList { + id: ll + objectName: "LauncherList" + anchors.fill: parent + Component.onCompleted: { + addExample("tap", "TapHandler: device-agnostic tap/click detection for buttons", Qt.resolvedUrl("tapHandler.qml")) + addExample("multibuttons", "TapHandler: gesturePolicy (99 red balloons)", Qt.resolvedUrl("multibuttons.qml")) + addExample("single point handler", "PointHandler: properties such as seat, device, modifiers, velocity, pressure", Qt.resolvedUrl("singlePointHandlerProperties.qml")) + addExample("hover sidebar", "HoverHandler: a hierarchy of items sharing the hover state", Qt.resolvedUrl("sidebar.qml")) + addExample("joystick", "DragHandler: move one item inside another with any pointing device", Qt.resolvedUrl("joystick.qml")) + addExample("mixer", "DragHandler: drag multiple sliders with multiple fingers", Qt.resolvedUrl("mixer.qml")) + addExample("fling animation", "DragHandler: after dragging, use an animation to simulate momentum", Qt.resolvedUrl("flingAnimation.qml")) + addExample("pinch", "PinchHandler: scale, rotate and drag", Qt.resolvedUrl("pinchHandler.qml")) + addExample("map", "scale, pan, re-render at different resolutions", Qt.resolvedUrl("map.qml")) + addExample("fake Flickable", "implementation of a simplified Flickable using only Items, DragHandler and MomentumAnimation", Qt.resolvedUrl("fakeFlickable.qml")) + addExample("tablet canvas", "PointHandler and HoverHandler with a tablet: detect the stylus, and draw", Qt.resolvedUrl("tabletCanvasDrawing.qml")) + } + } + Item { + id: glassPane + objectName: "glassPane" + z: 10000 + anchors.fill: parent + + // TODO use Instantiator to create these... but we need to be able to set their parents to glassPane somehow (QTBUG-64546) + TouchpointFeedbackSprite { } + TouchpointFeedbackSprite { } + TouchpointFeedbackSprite { } + TouchpointFeedbackSprite { } + TouchpointFeedbackSprite { } + TouchpointFeedbackSprite { } + + MouseFeedbackSprite { } + } +} diff --git a/examples/quick/pointerhandlers/qml.qrc b/examples/quick/pointerhandlers/qml.qrc new file mode 100644 index 0000000000..39164527de --- /dev/null +++ b/examples/quick/pointerhandlers/qml.qrc @@ -0,0 +1,47 @@ +<RCC> + <qresource prefix="/pointerhandlers"> + <file>flingAnimation.qml</file> + <file>fakeFlickable.qml</file> + <file>flickablesWithHandlers.qml</file> + <file>joystick.qml</file> + <file>map.qml</file> + <file>mixer.qml</file> + <file>multibuttons.qml</file> + <file>photosurface.qml</file> + <file>pinchHandler.qml</file> + <file>pointerDrag.qml</file> + <file>pointerhandlers.qml</file> + <file>singlePointHandlerProperties.qml</file> + <file>sidebar.qml</file> + <file>tabletCanvasDrawing.qml</file> + <file>tapHandler.qml</file> + <file>components/Button.qml</file> + <file>components/CheckBox.qml</file> + <file>components/FakeFlickable.qml</file> + <file>components/FlashAnimation.qml</file> + <file>components/LeftDrawer.qml</file> + <file>components/MomentumAnimation.qml</file> + <file>components/ScrollBar.qml</file> + <file>components/Slider.qml</file> + <file>components/TouchpointFeedbackSprite.qml</file> + <file>images/arrowhead.png</file> + <file>images/balloon.png</file> + <file>components/images/checkmark.png</file> + <file>images/cursor-airbrush.png</file> + <file>images/cursor-eraser.png</file> + <file>images/cursor-felt-marker.png</file> + <file>images/cursor-pencil.png</file> + <file>images/fighter.png</file> + <file>components/images/fingersprite.png</file> + <file>images/grabbing-location.svg</file> + <file>images/joystick-outer-case-pov.jpg</file> + <file>images/map.svgz</file> + <file>images/missile.png</file> + <file>components/images/mixer-knob.png</file> + <file>components/images/mouse.png</file> + <file>components/images/mouse_left.png</file> + <file>components/images/mouse_middle.png</file> + <file>components/images/mouse_right.png</file> + <file>images/redball.png</file> + </qresource> +</RCC> diff --git a/tests/manual/pointer/sidebar.qml b/examples/quick/pointerhandlers/sidebar.qml index cd59f1d5cf..60c781d46f 100644 --- a/tests/manual/pointer/sidebar.qml +++ b/examples/quick/pointerhandlers/sidebar.qml @@ -3,9 +3,9 @@ ** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $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 @@ -14,20 +14,42 @@ ** 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. +** 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 2.15 -import "content" +import "components" Rectangle { id: root diff --git a/tests/manual/pointer/singlePointHandlerProperties.qml b/examples/quick/pointerhandlers/singlePointHandlerProperties.qml index 9bebf23810..177e8eaaf5 100644 --- a/tests/manual/pointer/singlePointHandlerProperties.qml +++ b/examples/quick/pointerhandlers/singlePointHandlerProperties.qml @@ -1,11 +1,11 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $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 @@ -14,13 +14,35 @@ ** 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. +** 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$ ** @@ -89,7 +111,7 @@ Rectangle { Rectangle { id: velocityVector visible: width > 0 - width: pointHandler.point.velocity.length() * 100 + width: pointHandler.point.velocity.length() / 10 height: 2 x: pointHandler.point.position.x y: pointHandler.point.position.y @@ -98,7 +120,7 @@ Rectangle { antialiasing: true Image { - source: "resources/arrowhead.png" + source: "images/arrowhead.png" anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter width: 16 @@ -110,7 +132,7 @@ Rectangle { Component { id: grabbingLocationIndicator Image { - source: "resources/grabbing-location.svg" + source: "components/images/grabbing-location.svg" sourceSize.width: 32 sourceSize.height: 32 } @@ -120,17 +142,17 @@ Rectangle { id: mouseButtonIndicator Image { property int buttons - source: "resources/mouse.png" + source: "components/images/mouse.png" Image { - source: "resources/mouse_left.png" + source: "components/images/mouse_left.png" visible: buttons & Qt.LeftButton } Image { - source: "resources/mouse_middle.png" + source: "components/images/mouse_middle.png" visible: buttons & Qt.MiddleButton } Image { - source: "resources/mouse_right.png" + source: "components/images/mouse_right.png" visible: buttons & Qt.RightButton } } @@ -140,14 +162,25 @@ Rectangle { id: pointHandler target: null acceptedButtons: Qt.AllButtons - onGrabChanged: if (active) { // 'point' is an implicit parameter referencing to a QEventPoint instance - console.log("grabbed " + point.pointId + " @ " + point.sceneGrabPos) - grabbingLocationIndicator.createObject(root, {"x": point.sceneGrabPosition.x, "y": point.sceneGrabPosition.y - 16}) + onGrabChanged: function(transition, point) { + if (active) { + console.log("grabbed " + point.pointId + " @ " + point.sceneGrabPos) + grabbingLocationIndicator.createObject(root, {"x": point.sceneGrabPosition.x, "y": point.sceneGrabPosition.y - 16}) + } } onPointChanged: { - // Here, 'point' is referring to the property of the PointHandler if (point.pressedButtons) mouseButtonIndicator.createObject(root, {"x": point.pressPosition.x - 44, "y": point.pressPosition.y - 64, "buttons": point.pressedButtons}) } } + + Text { + color: "white" + text: "drag to see feedback" + anchors { + bottom: parent.bottom + horizontalCenter: parent.horizontalCenter + margins: 6 + } + } } diff --git a/tests/manual/pointer/tabletCanvasDrawing.qml b/examples/quick/pointerhandlers/tabletCanvasDrawing.qml index c340dee5f4..5c19bab31a 100644 --- a/tests/manual/pointer/tabletCanvasDrawing.qml +++ b/examples/quick/pointerhandlers/tabletCanvasDrawing.qml @@ -1,9 +1,9 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:BSD$ ** Commercial License Usage @@ -50,7 +50,7 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 -import "content" +import "components" Rectangle { width: 1024 @@ -165,6 +165,15 @@ Rectangle { } } + Text { + text: "draw with a drawing-tablet stylus" + anchors { + bottom: parent.bottom + horizontalCenter: parent.horizontalCenter + margins: 6 + } + } + PointHandler { acceptedPointerTypes: PointerDevice.Pen onActiveChanged: @@ -206,7 +215,7 @@ Rectangle { target: Image { parent: rect source: stylusHandler.point.rotation === 0 ? - "resources/cursor-pencil.png" : "resources/cursor-felt-marker.png" + "images/cursor-pencil.png" : "images/cursor-felt-marker.png" visible: stylusHandler.hovered rotation: stylusHandler.point.rotation x: stylusHandler.point.position.x @@ -220,7 +229,7 @@ Rectangle { acceptedPointerTypes: PointerDevice.Pen target: Image { parent: rect - source: "resources/cursor-airbrush.png" + source: "images/cursor-airbrush.png" visible: airbrushHandler.hovered x: airbrushHandler.point.position.x y: airbrushHandler.point.position.y @@ -232,7 +241,7 @@ Rectangle { acceptedPointerTypes: PointerDevice.Eraser target: Image { parent: rect - source: "resources/cursor-eraser.png" + source: "images/cursor-eraser.png" visible: eraserHandler.hovered x: eraserHandler.point.position.x y: eraserHandler.point.position.y - 32 diff --git a/tests/manual/pointer/tapHandler.qml b/examples/quick/pointerhandlers/tapHandler.qml index c25ea9eb4e..90cf778ede 100644 --- a/tests/manual/pointer/tapHandler.qml +++ b/examples/quick/pointerhandlers/tapHandler.qml @@ -1,11 +1,11 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** -** This file is part of the manual tests of the Qt Toolkit. +** This file is part of the examples of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** $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 @@ -14,24 +14,46 @@ ** 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. +** 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 2.12 -import "qrc:/quick/shared/" as Examples +import QtQuick +import "components" Item { - width: 480 - height: 320 + width: 800 + height: 480 Rectangle { id: rect @@ -66,7 +88,7 @@ Item { } onLongPressed: longPressFeedback.createObject(rect, {"x": point.position.x, "y": point.position.y, - "text": handler.timeHeld.toFixed(3) + " sec", + "text": "long press after\n" + handler.timeHeld.toFixed(3) + " sec", "color": buttonToBlinkColor(point.pressedButtons)}) } @@ -129,6 +151,15 @@ Item { ScriptAction { script: rect.border.color = "transparent" } PauseAnimation { duration: 100 } } + + Text { + text: "tap, click with different buttons, double-click, long press in this area" + anchors { + bottom: parent.bottom + horizontalCenter: parent.horizontalCenter + margins: 6 + } + } } function buttonToBlinkColor(button) { @@ -141,22 +172,28 @@ Item { Row { spacing: 6 - Text { text: "accepted mouse clicks:"; anchors.verticalCenter: leftAllowedCB.verticalCenter } - Examples.CheckBox { + Text { + text: "accepted mouse clicks:" + anchors.verticalCenter: leftAllowedCB.verticalCenter + } + CheckBox { id: leftAllowedCB checked: true - text: "left click" + text: "left" } - Examples.CheckBox { + CheckBox { id: middleAllowedCB - text: "middle click" + text: "middle" } - Examples.CheckBox { + CheckBox { id: rightAllowedCB - text: "right click" + text: "right" + } + Text { + text: " gesture policy:" + anchors.verticalCenter: leftAllowedCB.verticalCenter } - Text { text: " gesture policy:"; anchors.verticalCenter: leftAllowedCB.verticalCenter } - Examples.CheckBox { + CheckBox { id: policyDragThresholdCB text: "drag threshold" onCheckedChanged: if (checked) { @@ -164,7 +201,7 @@ Item { policyReleaseWithinBoundsCB.checked = false; } } - Examples.CheckBox { + CheckBox { id: policyWithinBoundsCB text: "within bounds" onCheckedChanged: if (checked) { @@ -172,7 +209,7 @@ Item { policyReleaseWithinBoundsCB.checked = false; } } - Examples.CheckBox { + CheckBox { id: policyReleaseWithinBoundsCB checked: true text: "release within bounds" diff --git a/examples/quick/pointerhandlers/tapWithModifiers.qml b/examples/quick/pointerhandlers/tapWithModifiers.qml new file mode 100644 index 0000000000..86b66512da --- /dev/null +++ b/examples/quick/pointerhandlers/tapWithModifiers.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the examples 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 2.12 + +Item { + width: 200 + height: 200 + TapHandler { + acceptedModifiers: Qt.ControlModifier + onTapped: console.log("control-tapped") + } + TapHandler { + acceptedModifiers: Qt.NoModifier + onTapped: console.log("tapped with no modifiers") + } + TapHandler { + onTapped: + switch (point.modifiers) { + case Qt.ControlModifier | Qt.AltModifier: + console.log("CTRL+ALT"); + break; + case Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier: + console.log("CTRL+META+ALT"); + break; + default: + console.log("other modifiers", point.modifiers) + } + } +} diff --git a/tests/manual/pointer/CMakeLists.txt b/tests/manual/pointer/CMakeLists.txt deleted file mode 100644 index aa8e15306b..0000000000 --- a/tests/manual/pointer/CMakeLists.txt +++ /dev/null @@ -1,110 +0,0 @@ -# Generated from pointer.pro. - -##################################################################### -## pointer Binary: -##################################################################### - -# special case begin -if(NOT TARGET Qt::Svg OR NOT TARGET Qt::Quick OR NOT TARGET Qt::Qml) - return() -endif() -# special case end - -qt_internal_add_manual_test(pointer - GUI - SOURCES - inputinspector.cpp inputinspector.h - main.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Qml - Qt::Quick - Qt::QuickPrivate - Qt::Svg -) - -# Resources: -set(qml_resource_files - "content/CheckBox.qml" - "content/FakeFlickable.qml" - "content/FlashAnimation.qml" - "content/MomentumAnimation.qml" - "content/MouseAreaButton.qml" - "content/MouseAreaSlider.qml" - "content/MouseFeedbackSprite.qml" - "content/MptaButton.qml" - "content/MultiButton.qml" - "content/ScrollBar.qml" - "content/Slider.qml" - "content/TapHandlerButton.qml" - "content/TextBox.qml" - "content/TouchpointFeedbackSprite.qml" - "fakeFlickable.qml" - "flickablesWithHandlers.qml" - "flingAnimation.qml" - "joystick.qml" - "main.qml" - "map.qml" - "map2.qml" - "mixer.qml" - "multibuttons.qml" - "photosurface.qml" - "pinchHandler.qml" - "pointerDrag.qml" - "resources/arrowhead.png" - "resources/balloon.png" - "resources/cursor-airbrush.png" - "resources/cursor-eraser.png" - "resources/cursor-felt-marker.png" - "resources/cursor-pencil.png" - "resources/fighter.png" - "resources/fingersprite.png" - "resources/grabbing-location.svg" - "resources/joystick-outer-case-pov.jpg" - "resources/map.svgz" - "resources/missile.png" - "resources/mixer-knob.png" - "resources/mouse.png" - "resources/mouse_left.png" - "resources/mouse_middle.png" - "resources/mouse_right.png" - "resources/redball.png" - "sidebar.qml" - "singlePointHandlerProperties.qml" - "tabletCanvasDrawing.qml" - "tapHandler.qml" -) - -qt_internal_add_resource(pointer "qml" - PREFIX - "/" - FILES - ${qml_resource_files} -) -set(quick_shared_resource_files - "../../../examples/quick/shared/Button.qml" - "../../../examples/quick/shared/CheckBox.qml" - "../../../examples/quick/shared/Label.qml" - "../../../examples/quick/shared/LauncherList.qml" - "../../../examples/quick/shared/SimpleLauncherDelegate.qml" - "../../../examples/quick/shared/Slider.qml" - "../../../examples/quick/shared/TextField.qml" - "../../../examples/quick/shared/images/back.png" - "../../../examples/quick/shared/images/checkmark.png" - "../../../examples/quick/shared/images/next.png" - "../../../examples/quick/shared/images/slider_handle.png" -) - -qt_internal_add_resource(pointer "quick_shared" - PREFIX - "/quick/shared" - BASE - "../../../examples/quick/shared" - FILES - ${quick_shared_resource_files} -) - -qt_import_qml_plugins(pointer) # special case - -#### Keys ignored in scope 1:.:.:pointer.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/manual/pointer/content/MultiButton.qml b/tests/manual/pointer/content/MultiButton.qml deleted file mode 100644 index 485784a875..0000000000 --- a/tests/manual/pointer/content/MultiButton.qml +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 - -Rectangle { - id: root - property alias label: label.text - property alias pressed: tap.pressed - property bool checked: false - property alias gesturePolicy: tap.gesturePolicy - property alias margin: tap.margin - signal tapped - - width: label.implicitWidth * 1.5; height: label.implicitHeight * 2.0 - border.color: "#9f9d9a"; border.width: 1; radius: height / 4; antialiasing: true - - gradient: Gradient { - GradientStop { position: 0.0; color: tap.pressed ? "#b8b5b2" : "#efebe7" } - GradientStop { position: 1.0; color: "#b8b5b2" } - } - - TapHandler { - id: tap - objectName: label.text - onTapped: { - tapFlash.start() - root.tapped() - } - } - - Text { - id: label - font.pointSize: 14 - text: "Button" - anchors.centerIn: parent - } - - Rectangle { - anchors.fill: parent - color: "transparent" - border.width: 2; radius: root.radius; antialiasing: true - opacity: tapFlash.running ? 1 : 0 - FlashAnimation on visible { - id: tapFlash - } - } -} diff --git a/tests/manual/pointer/flickablesWithHandlers.qml b/tests/manual/pointer/flickablesWithHandlers.qml index 3a854b2d14..a94af1c329 100644 --- a/tests/manual/pointer/flickablesWithHandlers.qml +++ b/tests/manual/pointer/flickablesWithHandlers.qml @@ -27,7 +27,6 @@ ****************************************************************************/ import QtQuick -import "qrc:/quick/shared/" as Examples import "content" Rectangle { @@ -59,10 +58,10 @@ Rectangle { height: pressDelayCB.implicitHeight + 12 x: 6 color: "lightgray" - Examples.CheckBox { + CheckBox { x: 6; y: 6 id: pressDelayCB - text: "press delay" + label: "press delay" } } diff --git a/tests/manual/pointer/inputinspector.cpp b/tests/manual/pointer/inputinspector.cpp deleted file mode 100644 index ee1b4e70c0..0000000000 --- a/tests/manual/pointer/inputinspector.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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$ -** -****************************************************************************/ - -#include "inputinspector.h" -#include <QtQuick/QQuickItem> -#include <QtQuick/private/qquickpointerhandler_p.h> -#include <QtGui/private/qpointingdevice_p.h> -#include <QtCore/QSet> - -static const int timerInterval = 100; - -InputInspector::InputInspector(QObject *parent) : QObject(parent) -{ -} - -InputInspector::~InputInspector() -{ - m_window = nullptr; - killTimer(m_timerId); -} - -QString InputInspector::mouseGrabber() const -{ - QString name; - if (m_window) { - if (QQuickItem *grabber = m_window->mouseGrabberItem()) { - name = objectIdentifier(grabber); - } else { - name = QLatin1String("no grabber"); - } - } else { - name = "ERROR: need a source window"; - } - return name; -} - -QString InputInspector::passiveGrabbers() const -{ - return vectorStringJoin(passiveGrabbers_helper()); -} - -QString InputInspector::exclusiveGrabbers() const -{ - return vectorStringJoin(exclusiveGrabbers_helper()); -} - -QString InputInspector::vectorStringJoin(const QVector<QObject*> &arr) const -{ - QString res; - for (QObject* obj: arr) { - if (!res.isEmpty()) - res += QLatin1String(" , "); - res += objectIdentifier(obj); - } - res.prepend(QLatin1String("[")); - res += QLatin1String("]"); - return res; -} - -QQuickWindow *InputInspector::source() const -{ - return m_window; -} - -void InputInspector::setSource(QQuickWindow *window) -{ - m_window = window; - if (m_window && !m_timerId) - m_timerId = startTimer(timerInterval); - emit sourceChanged(); -} - -void InputInspector::update() -{ - const QString mouseGrabberName = mouseGrabber(); - if (lastState.mouseGrabber != mouseGrabberName) { - emit mouseGrabberChanged(); - lastState.mouseGrabber = mouseGrabberName; - } - - const QString tempPassiveGrabbers = passiveGrabbers(); - if (lastState.passiveGrabbers != tempPassiveGrabbers) { - emit passiveGrabbersChanged(); - lastState.passiveGrabbers = tempPassiveGrabbers; - } - - const QString tempExclusiveGrabbers = exclusiveGrabbers(); - if (lastState.exclusiveGrabbers != tempExclusiveGrabbers) { - emit exclusiveGrabbersChanged(); - lastState.exclusiveGrabbers = tempExclusiveGrabbers; - } -} - -void InputInspector::timerEvent(QTimerEvent *event) -{ - if (event->timerId() == m_timerId) - update(); -} - -const QPointingDevice *InputInspector::pointerDevice() const -{ - const QPointingDevice *device = nullptr; - for (const auto dev : QInputDevice::devices()) { - if (dev->type() == QInputDevice::DeviceType::TouchScreen) { - device = static_cast<const QPointingDevice *>(dev); - break; - } - } - if (!device) - device = QPointingDevice::primaryPointingDevice(); - return device; -} - -QVector<QObject*> InputInspector::passiveGrabbers_helper(int pointId /*= 0*/) const -{ - QVector<QObject*> result; - const QPointingDevice *device = pointerDevice(); - if (device && source()) { - for (auto &epd : QPointingDevicePrivate::get(device)->activePoints.values()) { - if (!pointId || epd.eventPoint.id() == pointId) { - for (auto pg : epd.passiveGrabbers) { - if (!result.contains(pg)) - result << pg; - } - } - } - } - return result; -} - -QVector<QObject*> InputInspector::exclusiveGrabbers_helper(int pointId /*= 0*/) const -{ - QVector<QObject*> result; - const QPointingDevice *device = pointerDevice(); - if (device && source()) { - for (auto &epd : QPointingDevicePrivate::get(device)->activePoints.values()) { - if (!pointId || epd.eventPoint.id() == pointId) { - if (auto g = epd.exclusiveGrabber.data()) { - if (!result.contains(g)) - result << g; - } - } - } - } - return result; -} - -QString InputInspector::objectIdentifier(QObject *o) -{ - QString name; - name = o->objectName(); - if (name.isEmpty()) - name = o->property("text").toString(); - if (name.isEmpty()) - name = o->metaObject()->className(); - if (name.isEmpty()) - name = QLatin1String("unknown"); - - return name; -} diff --git a/tests/manual/pointer/inputinspector.h b/tests/manual/pointer/inputinspector.h deleted file mode 100644 index 31d99cf25d..0000000000 --- a/tests/manual/pointer/inputinspector.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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$ -** -****************************************************************************/ - -#ifndef INPUTINSPECTOR_H -#define INPUTINSPECTOR_H - -#include <QObject> -#include <QtQuick/QQuickWindow> -class QQuickPointerHandler; -class QPointingDevice; - -class InputInspector : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString mouseGrabber READ mouseGrabber NOTIFY mouseGrabberChanged) - Q_PROPERTY(QString passiveGrabbers READ passiveGrabbers NOTIFY passiveGrabbersChanged) - Q_PROPERTY(QString exclusiveGrabbers READ exclusiveGrabbers NOTIFY exclusiveGrabbersChanged) - Q_PROPERTY(QQuickWindow * source READ source WRITE setSource NOTIFY sourceChanged) -public: - explicit InputInspector(QObject *parent = nullptr); - ~InputInspector(); - QString mouseGrabber() const; - QString passiveGrabbers() const; - QString exclusiveGrabbers() const; - QQuickWindow *source() const; - void setSource(QQuickWindow *window); - - void timerEvent(QTimerEvent *event); - Q_INVOKABLE void update(); - -signals: - void mouseGrabberChanged(); - void passiveGrabbersChanged(); - void exclusiveGrabbersChanged(); - void sourceChanged(); -private: - QVector<QObject*> passiveGrabbers_helper(int pointId = 0) const; - QVector<QObject*> exclusiveGrabbers_helper(int pointId = 0) const; - static QString objectIdentifier(QObject *o); - const QPointingDevice *pointerDevice() const; - QString vectorStringJoin(const QVector<QObject*> &arr) const; - -private: - mutable struct LastState { - QString mouseGrabber; - QString passiveGrabbers; - QString exclusiveGrabbers; - } lastState; - - QQuickWindow *m_window = nullptr; - int m_timerId = 0; -}; - -#endif // INPUTINSPECTOR_H diff --git a/tests/manual/pointer/main.cpp b/tests/manual/pointer/main.cpp deleted file mode 100644 index 87a38382c1..0000000000 --- a/tests/manual/pointer/main.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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$ -** -****************************************************************************/ -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQuickItem> -#include <QQuickWindow> -#include "inputinspector.h" - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - qmlRegisterType<InputInspector>("org.qtproject.Test", 1, 0, "InputInspector"); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - if (engine.rootObjects().isEmpty()) - return -1; - if (!app.arguments().isEmpty()) { - QQuickWindow * win = static_cast<QQuickWindow *>(engine.rootObjects().first()); - auto lastArg = app.arguments().last(); - if (lastArg.endsWith(QLatin1String(".qml"))) { - auto root = win->findChild<QQuickItem *>("LauncherList"); - int showExampleIdx = -1; - for (int i = root->metaObject()->methodCount(); showExampleIdx < 0 && i >= 0; --i) - if (root->metaObject()->method(i).name() == QByteArray("showExample")) - showExampleIdx = i; - QMetaMethod showExampleFn = root->metaObject()->method(showExampleIdx); - showExampleFn.invoke(root, Q_ARG(QVariant, QVariant(QLatin1String("../../") + lastArg))); - } - } - - return app.exec(); -} diff --git a/tests/manual/pointer/main.qml b/tests/manual/pointer/main.qml deleted file mode 100644 index c7c1380c64..0000000000 --- a/tests/manual/pointer/main.qml +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 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 -import QtQuick.Window 2.12 -import QtQuick.Layouts 1.2 -import org.qtproject.Test 1.0 -import "qrc:/quick/shared/" as Examples -import "content" - -Window { - id: window - width: 800 - height: 600 - visible: true - Examples.LauncherList { - id: ll - objectName: "LauncherList" - anchors.fill: parent - Component.onCompleted: { - addExample("single point handler", "QQuickPointerSingleHandler: test properties copied from events", Qt.resolvedUrl("singlePointHandlerProperties.qml")) - addExample("hover", "ensure that a hierarchy of items can share the hover state", Qt.resolvedUrl("sidebar.qml")) - addExample("joystick", "DragHandler: move one item inside another with any pointing device", Qt.resolvedUrl("joystick.qml")) - addExample("mixer", "mixing console", Qt.resolvedUrl("mixer.qml")) - addExample("pinch", "PinchHandler: scale, rotate and drag", Qt.resolvedUrl("pinchHandler.qml")) - addExample("map", "scale and pan", Qt.resolvedUrl("map.qml")) - addExample("custom map", "scale and pan", Qt.resolvedUrl("map2.qml")) - addExample("fling animation", "DragHandler: after dragging, use an animation to simulate momentum", Qt.resolvedUrl("flingAnimation.qml")) - addExample("fake Flickable", "implementation of a simplified Flickable using only Items, DragHandler and MomentumAnimation", Qt.resolvedUrl("fakeFlickable.qml")) - addExample("photo surface", "re-implementation of the existing photo surface demo using Handlers", Qt.resolvedUrl("photosurface.qml")) - addExample("tap", "TapHandler: device-agnostic tap/click detection for buttons", Qt.resolvedUrl("tapHandler.qml")) - addExample("multibuttons", "TapHandler: gesturePolicy (99 red balloons)", Qt.resolvedUrl("multibuttons.qml")) - addExample("flickables with Handlers", "Parallel Flickables with buttons, sliders etc. implemented in various ways", Qt.resolvedUrl("flickablesWithHandlers.qml")) - addExample("tap and drag", "Flickable with all possible combinations of TapHandler and DragHandler children", Qt.resolvedUrl("pointerDrag.qml")) - addExample("tablet canvas", "PointHandler and HoverHandler with a tablet: detect the stylus, and draw", Qt.resolvedUrl("tabletCanvasDrawing.qml")) - } - } - Item { - id: glassPane - objectName: "glassPane" - z: 10000 - anchors.fill: parent - - // TODO use Instantiator to create these... but we need to be able to set their parents to glassPane somehow (QTBUG-64546) - TouchpointFeedbackSprite { } - TouchpointFeedbackSprite { } - TouchpointFeedbackSprite { } - TouchpointFeedbackSprite { } - TouchpointFeedbackSprite { } - TouchpointFeedbackSprite { } - - MouseFeedbackSprite { } - - InputInspector { - id: inspector - source: window - } - - Rectangle { - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.margins: 4 - radius: 5 - width: Math.max(grid.implicitWidth, 400) - implicitHeight: grid.implicitHeight - color: "#40404080" - GridLayout { - id: grid - width: parent.width - columns: 3 - Text { text: "mouseGrabber" } Text { text: inspector.mouseGrabber } Item { Layout.fillWidth: true } - Text { text: "passiveGrabbers" } Text { text: inspector.passiveGrabbers } Item { Layout.fillWidth: true } - Text { text: "exclusiveGrabbers" } Text { text: inspector.exclusiveGrabbers } Item { Layout.fillWidth: true } - } - } - } -} diff --git a/tests/manual/pointer/mixer.qml b/tests/manual/pointer/mixer.qml deleted file mode 100644 index 6044b59633..0000000000 --- a/tests/manual/pointer/mixer.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** 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 -import "content" - -Rectangle { - id: root - width: 1280 - height: 960 - objectName: "root" - color: "#222222" - - ListView { - id: list - objectName: "listView" - anchors.fill: parent - anchors.margins: 10 - orientation: Qt.Horizontal - - model: 20 - - delegate: Item { - objectName: "delegateItem" + index - width: 154 - height: list.height - - Slider { - anchors.fill: parent - label: "Channel " + (index + 1) - } - } - } -} diff --git a/tests/manual/pointer/multibuttons.qml b/tests/manual/pointer/multibuttons.qml deleted file mode 100644 index d143134a3a..0000000000 --- a/tests/manual/pointer/multibuttons.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 -import QtQuick.Particles 2.0 -import QtQuick.Layouts 1.0 -import "content" - -Item { - width: 800 - height: 800 - ColumnLayout { - anchors.right: parent.right - spacing: 20 - Text { text: "protagonist"; font.pointSize: 12 } - MultiButton { - id: balloonsButton - label: "Launch Balloons" - Layout.fillWidth: true - gesturePolicy: TapHandler.WithinBounds - margin: 10 - } - Text { text: "the goons"; font.pointSize: 12 } - MultiButton { - id: missilesButton - label: "Launch Missile" - Layout.fillWidth: true - gesturePolicy: TapHandler.ReleaseWithinBounds - margin: 10 - onTapped: missileEmitter.burst(1) - } - MultiButton { - id: fightersButton - label: "Launch Fighters" - Layout.fillWidth: true - gesturePolicy: TapHandler.DragThreshold - margin: 10 - } - } - ParticleSystem { - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.leftMargin: 150 - ImageParticle { source: "resources/balloon.png" } - Emitter { anchors.bottom: parent.bottom; enabled: balloonsButton.pressed; lifeSpan: 5000; size: 64 - maximumEmitted: 99 - emitRate: 50; velocity: PointDirection { x: 10; y: -150; yVariation: 30; xVariation: 50 } } } - ParticleSystem { - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - ImageParticle { source: "resources/fighter.png" } - Emitter { anchors.bottom: parent.bottom; enabled: fightersButton.pressed; lifeSpan: 15000; size: 204 - emitRate: 3; velocity: PointDirection { x: -1000; y: -250; yVariation: 150; xVariation: 50 } } } - ParticleSystem { - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.rightMargin: 100 - ImageParticle { source: "resources/missile.png"; autoRotation: true; rotation: 90 } - Emitter { id: missileEmitter; anchors.bottom: parent.bottom; lifeSpan: 5000; size: 128; - emitRate: 0; velocity: PointDirection { x: -200; y: -350; yVariation: 200; xVariation: 100 } } } -} diff --git a/tests/manual/pointer/qml.qrc b/tests/manual/pointer/qml.qrc deleted file mode 100644 index 79df367391..0000000000 --- a/tests/manual/pointer/qml.qrc +++ /dev/null @@ -1,52 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>flingAnimation.qml</file> - <file>main.qml</file> - <file>fakeFlickable.qml</file> - <file>flickablesWithHandlers.qml</file> - <file>joystick.qml</file> - <file>map.qml</file> - <file>mixer.qml</file> - <file>multibuttons.qml</file> - <file>photosurface.qml</file> - <file>pinchHandler.qml</file> - <file>pointerDrag.qml</file> - <file>singlePointHandlerProperties.qml</file> - <file>sidebar.qml</file> - <file>tabletCanvasDrawing.qml</file> - <file>tapHandler.qml</file> - <file>content/CheckBox.qml</file> - <file>content/FakeFlickable.qml</file> - <file>content/FlashAnimation.qml</file> - <file>content/MomentumAnimation.qml</file> - <file>content/MouseAreaButton.qml</file> - <file>content/MouseAreaSlider.qml</file> - <file>content/MouseFeedbackSprite.qml</file> - <file>content/MptaButton.qml</file> - <file>content/MultiButton.qml</file> - <file>content/ScrollBar.qml</file> - <file>content/Slider.qml</file> - <file>content/TapHandlerButton.qml</file> - <file>content/TextBox.qml</file> - <file>content/TouchpointFeedbackSprite.qml</file> - <file>resources/arrowhead.png</file> - <file>resources/balloon.png</file> - <file>resources/cursor-airbrush.png</file> - <file>resources/cursor-eraser.png</file> - <file>resources/cursor-felt-marker.png</file> - <file>resources/cursor-pencil.png</file> - <file>resources/fighter.png</file> - <file>resources/fingersprite.png</file> - <file>resources/grabbing-location.svg</file> - <file>resources/joystick-outer-case-pov.jpg</file> - <file>resources/map.svgz</file> - <file>resources/missile.png</file> - <file>resources/mixer-knob.png</file> - <file>resources/mouse.png</file> - <file>resources/mouse_left.png</file> - <file>resources/mouse_middle.png</file> - <file>resources/mouse_right.png</file> - <file>resources/redball.png</file> - <file>map2.qml</file> - </qresource> -</RCC> |