From eeffa8ee95ae62aec9b593d838c3fb3478d4cf10 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 30 Aug 2021 12:23:49 +0200 Subject: Fix touchinteraction example to use QML modules Remove the "content" subdirectories. They just add noise. Change-Id: Iae6bf7d91b6804294673be8966e30b11caae0654 Reviewed-by: Andrei Golubev Reviewed-by: Fabian Kosmale (cherry picked from commit 76a413bb11dd444239d3e0ae5fc86a3021d53409) Reviewed-by: Qt Cherry-pick Bot --- examples/quick/touchinteraction/CMakeLists.txt | 98 ++++------- .../touchinteraction/doc/src/touchinteraction.qdoc | 2 +- .../quick/touchinteraction/flickable/Panel.qml | 155 +++++++++++++++++ .../touchinteraction/flickable/content/Panel.qml | 155 ----------------- .../touchinteraction/flickable/content/cork.jpg | Bin 149337 -> 0 bytes .../flickable/content/note-yellow.png | Bin 54283 -> 0 bytes .../touchinteraction/flickable/content/tack.png | Bin 7282 -> 0 bytes examples/quick/touchinteraction/flickable/cork.jpg | Bin 0 -> 149337 bytes .../touchinteraction/flickable/corkboards.qml | 1 - .../touchinteraction/flickable/note-yellow.png | Bin 0 -> 54283 bytes examples/quick/touchinteraction/flickable/tack.png | Bin 0 -> 7282 bytes .../multipointtouch/AugmentedTouchPoint.qml | 82 +++++++++ .../touchinteraction/multipointtouch/Bear0.png | Bin 0 -> 14359 bytes .../touchinteraction/multipointtouch/Bear1.png | Bin 0 -> 99378 bytes .../touchinteraction/multipointtouch/Bear2.png | Bin 0 -> 80759 bytes .../touchinteraction/multipointtouch/Bear3.png | Bin 0 -> 21122 bytes .../touchinteraction/multipointtouch/BearB.png | Bin 0 -> 16505 bytes .../multipointtouch/BearWhackParticleSystem.qml | 193 +++++++++++++++++++++ .../multipointtouch/ParticleFlame.qml | 80 +++++++++ .../touchinteraction/multipointtouch/bearwhack.qml | 3 +- .../multipointtouch/blur-circle.png | Bin 0 -> 4279 bytes .../multipointtouch/blur-circle3.png | Bin 0 -> 5148 bytes .../content/AugmentedTouchPoint.qml | 82 --------- .../multipointtouch/content/Bear0.png | Bin 14359 -> 0 bytes .../multipointtouch/content/Bear1.png | Bin 99378 -> 0 bytes .../multipointtouch/content/Bear2.png | Bin 80759 -> 0 bytes .../multipointtouch/content/Bear3.png | Bin 21122 -> 0 bytes .../multipointtouch/content/BearB.png | Bin 16505 -> 0 bytes .../content/BearWhackParticleSystem.qml | 193 --------------------- .../multipointtouch/content/ParticleFlame.qml | 80 --------- .../multipointtouch/content/blur-circle.png | Bin 4279 -> 0 bytes .../multipointtouch/content/blur-circle3.png | Bin 5148 -> 0 bytes .../multipointtouch/content/heart-blur.png | Bin 5406 -> 0 bytes .../multipointtouch/content/title.png | Bin 76389 -> 0 bytes .../multipointtouch/heart-blur.png | Bin 0 -> 5406 bytes .../multipointtouch/multiflame.qml | 1 - .../touchinteraction/multipointtouch/title.png | Bin 0 -> 76389 bytes .../quick/touchinteraction/touchinteraction.qml | 2 +- .../touchinteraction/touchinteraction.qmlproject | 1 + .../quick/touchinteraction/touchinteraction.qrc | 32 ++-- 40 files changed, 565 insertions(+), 595 deletions(-) create mode 100644 examples/quick/touchinteraction/flickable/Panel.qml delete mode 100644 examples/quick/touchinteraction/flickable/content/Panel.qml delete mode 100644 examples/quick/touchinteraction/flickable/content/cork.jpg delete mode 100644 examples/quick/touchinteraction/flickable/content/note-yellow.png delete mode 100644 examples/quick/touchinteraction/flickable/content/tack.png create mode 100644 examples/quick/touchinteraction/flickable/cork.jpg create mode 100644 examples/quick/touchinteraction/flickable/note-yellow.png create mode 100644 examples/quick/touchinteraction/flickable/tack.png create mode 100644 examples/quick/touchinteraction/multipointtouch/AugmentedTouchPoint.qml create mode 100644 examples/quick/touchinteraction/multipointtouch/Bear0.png create mode 100644 examples/quick/touchinteraction/multipointtouch/Bear1.png create mode 100644 examples/quick/touchinteraction/multipointtouch/Bear2.png create mode 100644 examples/quick/touchinteraction/multipointtouch/Bear3.png create mode 100644 examples/quick/touchinteraction/multipointtouch/BearB.png create mode 100644 examples/quick/touchinteraction/multipointtouch/BearWhackParticleSystem.qml create mode 100644 examples/quick/touchinteraction/multipointtouch/ParticleFlame.qml create mode 100644 examples/quick/touchinteraction/multipointtouch/blur-circle.png create mode 100644 examples/quick/touchinteraction/multipointtouch/blur-circle3.png delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/Bear0.png delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/Bear1.png delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/Bear2.png delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/Bear3.png delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/BearB.png delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/BearWhackParticleSystem.qml delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/ParticleFlame.qml delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/blur-circle.png delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/blur-circle3.png delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/heart-blur.png delete mode 100644 examples/quick/touchinteraction/multipointtouch/content/title.png create mode 100644 examples/quick/touchinteraction/multipointtouch/heart-blur.png create mode 100644 examples/quick/touchinteraction/multipointtouch/title.png diff --git a/examples/quick/touchinteraction/CMakeLists.txt b/examples/quick/touchinteraction/CMakeLists.txt index 48c857758a..a5dd1416ba 100644 --- a/examples/quick/touchinteraction/CMakeLists.txt +++ b/examples/quick/touchinteraction/CMakeLists.txt @@ -20,82 +20,54 @@ find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Quick) find_package(Qt6 COMPONENTS Qml) -qt_add_executable(touchinteraction +add_subdirectory("../shared" "shared") + +qt_add_executable(touchinteractionexample main.cpp ) -set_target_properties(touchinteraction PROPERTIES +set_target_properties(touchinteractionexample PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE ) -target_link_libraries(touchinteraction PUBLIC +target_link_libraries(touchinteractionexample PUBLIC Qt::Core Qt::Gui Qt::Qml Qt::Quick + touchinteraction_shared ) - -# Resources: -set(touchinteraction_resource_files - "flickable/basic-flickable.qml" - "flickable/content/Panel.qml" - "flickable/content/cork.jpg" - "flickable/content/note-yellow.png" - "flickable/content/tack.png" - "flickable/corkboards.qml" - "multipointtouch/bearwhack.qml" - "multipointtouch/content/AugmentedTouchPoint.qml" - "multipointtouch/content/Bear0.png" - "multipointtouch/content/Bear1.png" - "multipointtouch/content/Bear2.png" - "multipointtouch/content/Bear3.png" - "multipointtouch/content/BearB.png" - "multipointtouch/content/BearWhackParticleSystem.qml" - "multipointtouch/content/ParticleFlame.qml" - "multipointtouch/content/blur-circle.png" - "multipointtouch/content/blur-circle3.png" - "multipointtouch/content/heart-blur.png" - "multipointtouch/content/title.png" - "multipointtouch/multiflame.qml" - "pincharea/flickresize.qml" - "pincharea/qt-logo.jpg" - "touchinteraction.qml" -) - -qt6_add_resources(touchinteraction "touchinteraction" - PREFIX - "/touchinteraction" - FILES - ${touchinteraction_resource_files} -) -set(shared_resource_files - "../shared/Button.qml" - "../shared/CheckBox.qml" - "../shared/FlickrRssModel.qml" - "../shared/Label.qml" - "../shared/LauncherList.qml" - "../shared/SimpleLauncherDelegate.qml" - "../shared/Slider.qml" - "../shared/TabSet.qml" - "../shared/TextField.qml" - "../shared/images/back.png" - "../shared/images/checkmark.png" - "../shared/images/next.png" - "../shared/images/qt-logo.png" - "../shared/images/slider_handle.png" - "../shared/images/tab.png" -) - -qt6_add_resources(touchinteraction "shared" - PREFIX - "/shared" - BASE - "../shared" - FILES - ${shared_resource_files} +qt_add_qml_module(touchinteractionexample + URI touchinteraction + VERSION 1.0 + QML_FILES + "flickable/Panel.qml" + "flickable/basic-flickable.qml" + "flickable/corkboards.qml" + "multipointtouch/AugmentedTouchPoint.qml" + "multipointtouch/BearWhackParticleSystem.qml" + "multipointtouch/ParticleFlame.qml" + "multipointtouch/bearwhack.qml" + "multipointtouch/multiflame.qml" + "pincharea/flickresize.qml" + "touchinteraction.qml" + RESOURCES + "flickable/cork.jpg" + "flickable/note-yellow.png" + "flickable/tack.png" + "multipointtouch/Bear0.png" + "multipointtouch/Bear1.png" + "multipointtouch/Bear2.png" + "multipointtouch/Bear3.png" + "multipointtouch/BearB.png" + "multipointtouch/blur-circle.png" + "multipointtouch/blur-circle3.png" + "multipointtouch/heart-blur.png" + "multipointtouch/title.png" + "pincharea/qt-logo.jpg" ) -install(TARGETS touchinteraction +install(TARGETS touchinteractionexample RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" diff --git a/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc b/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc index 8526a9d58f..4adf1f8c03 100644 --- a/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc +++ b/examples/quick/touchinteraction/doc/src/touchinteraction.qdoc @@ -56,7 +56,7 @@ is done through a SpriteGoal that follows the TouchPoint. The TouchPoints added to the MultiPointTouchArea are a component with the relevant logic embedded into it: - \snippet touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml 0 + \snippet touchinteraction/multipointtouch/AugmentedTouchPoint.qml 0 \section1 Flick Resize Example diff --git a/examples/quick/touchinteraction/flickable/Panel.qml b/examples/quick/touchinteraction/flickable/Panel.qml new file mode 100644 index 0000000000..0aae0635b2 --- /dev/null +++ b/examples/quick/touchinteraction/flickable/Panel.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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.0 + +Item { + required property string name + required property var notes + + property real horizontalVelocity: 0 + + id: page + width: ListView.view.width+40; height: ListView.view.height + + + Image { + source: "cork.jpg" + width: page.ListView.view.width + height: page.ListView.view.height + fillMode: Image.PreserveAspectCrop + clip: true + } + + MouseArea { + anchors.fill: parent + onClicked: page.focus = false; + } + + Text { + text: page.name; x: 15; y: 8; height: 40; width: 370 + font.pixelSize: 18; font.bold: true; color: "white" + style: Text.Outline; styleColor: "black" + } + + Repeater { + model: page.notes + Item { + id: stickyPage + required property string noteText + + property int randomX: Math.random() * (page.ListView.view.width-0.5*stickyImage.width) +100 + property int randomY: Math.random() * (page.ListView.view.height-0.5*stickyImage.height) +50 + + x: randomX; y: randomY + + rotation: -page.horizontalVelocity / 100 + Behavior on rotation { + SpringAnimation { spring: 2.0; damping: 0.15 } + } + + Item { + id: sticky + scale: 0.7 + + Image { + id: stickyImage + x: 8 + -width * 0.6 / 2; y: -20 + source: "note-yellow.png" + scale: 0.6; transformOrigin: Item.TopLeft + } + + TextEdit { + id: myText + x: -104; y: 36; width: 215; height: 200 + font.pixelSize: 24 + readOnly: false + rotation: -8 + text: stickyPage.noteText + } + + Item { + x: stickyImage.x; y: -20 + width: stickyImage.width * stickyImage.scale + height: stickyImage.height * stickyImage.scale + + MouseArea { + id: mouse + anchors.fill: parent + drag.target: stickyPage + drag.axis: Drag.XAndYAxis + drag.minimumY: 0 + drag.maximumY: page.height - 80 + drag.minimumX: 100 + drag.maximumX: page.width - 140 + onClicked: myText.forceActiveFocus() + } + } + } + + Image { + x: -width / 2; y: -height * 0.5 / 2 + source: "tack.png" + scale: 0.7; transformOrigin: Item.TopLeft + } + + states: State { + name: "pressed" + when: mouse.pressed + PropertyChanges { target: sticky; rotation: 8; scale: 1 } + PropertyChanges { target: page; z: 8 } + } + + transitions: Transition { + NumberAnimation { properties: "rotation,scale"; duration: 200 } + } + } + } +} diff --git a/examples/quick/touchinteraction/flickable/content/Panel.qml b/examples/quick/touchinteraction/flickable/content/Panel.qml deleted file mode 100644 index 0aae0635b2..0000000000 --- a/examples/quick/touchinteraction/flickable/content/Panel.qml +++ /dev/null @@ -1,155 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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.0 - -Item { - required property string name - required property var notes - - property real horizontalVelocity: 0 - - id: page - width: ListView.view.width+40; height: ListView.view.height - - - Image { - source: "cork.jpg" - width: page.ListView.view.width - height: page.ListView.view.height - fillMode: Image.PreserveAspectCrop - clip: true - } - - MouseArea { - anchors.fill: parent - onClicked: page.focus = false; - } - - Text { - text: page.name; x: 15; y: 8; height: 40; width: 370 - font.pixelSize: 18; font.bold: true; color: "white" - style: Text.Outline; styleColor: "black" - } - - Repeater { - model: page.notes - Item { - id: stickyPage - required property string noteText - - property int randomX: Math.random() * (page.ListView.view.width-0.5*stickyImage.width) +100 - property int randomY: Math.random() * (page.ListView.view.height-0.5*stickyImage.height) +50 - - x: randomX; y: randomY - - rotation: -page.horizontalVelocity / 100 - Behavior on rotation { - SpringAnimation { spring: 2.0; damping: 0.15 } - } - - Item { - id: sticky - scale: 0.7 - - Image { - id: stickyImage - x: 8 + -width * 0.6 / 2; y: -20 - source: "note-yellow.png" - scale: 0.6; transformOrigin: Item.TopLeft - } - - TextEdit { - id: myText - x: -104; y: 36; width: 215; height: 200 - font.pixelSize: 24 - readOnly: false - rotation: -8 - text: stickyPage.noteText - } - - Item { - x: stickyImage.x; y: -20 - width: stickyImage.width * stickyImage.scale - height: stickyImage.height * stickyImage.scale - - MouseArea { - id: mouse - anchors.fill: parent - drag.target: stickyPage - drag.axis: Drag.XAndYAxis - drag.minimumY: 0 - drag.maximumY: page.height - 80 - drag.minimumX: 100 - drag.maximumX: page.width - 140 - onClicked: myText.forceActiveFocus() - } - } - } - - Image { - x: -width / 2; y: -height * 0.5 / 2 - source: "tack.png" - scale: 0.7; transformOrigin: Item.TopLeft - } - - states: State { - name: "pressed" - when: mouse.pressed - PropertyChanges { target: sticky; rotation: 8; scale: 1 } - PropertyChanges { target: page; z: 8 } - } - - transitions: Transition { - NumberAnimation { properties: "rotation,scale"; duration: 200 } - } - } - } -} diff --git a/examples/quick/touchinteraction/flickable/content/cork.jpg b/examples/quick/touchinteraction/flickable/content/cork.jpg deleted file mode 100644 index 160bc002bf..0000000000 Binary files a/examples/quick/touchinteraction/flickable/content/cork.jpg and /dev/null differ diff --git a/examples/quick/touchinteraction/flickable/content/note-yellow.png b/examples/quick/touchinteraction/flickable/content/note-yellow.png deleted file mode 100644 index 3195952ad2..0000000000 Binary files a/examples/quick/touchinteraction/flickable/content/note-yellow.png and /dev/null differ diff --git a/examples/quick/touchinteraction/flickable/content/tack.png b/examples/quick/touchinteraction/flickable/content/tack.png deleted file mode 100644 index cef2d1cd23..0000000000 Binary files a/examples/quick/touchinteraction/flickable/content/tack.png and /dev/null differ diff --git a/examples/quick/touchinteraction/flickable/cork.jpg b/examples/quick/touchinteraction/flickable/cork.jpg new file mode 100644 index 0000000000..160bc002bf Binary files /dev/null and b/examples/quick/touchinteraction/flickable/cork.jpg differ diff --git a/examples/quick/touchinteraction/flickable/corkboards.qml b/examples/quick/touchinteraction/flickable/corkboards.qml index 4825053f3f..2188219a64 100644 --- a/examples/quick/touchinteraction/flickable/corkboards.qml +++ b/examples/quick/touchinteraction/flickable/corkboards.qml @@ -49,7 +49,6 @@ ****************************************************************************/ import QtQuick 2.0 -import "content" Rectangle { width: 320; height: 480 diff --git a/examples/quick/touchinteraction/flickable/note-yellow.png b/examples/quick/touchinteraction/flickable/note-yellow.png new file mode 100644 index 0000000000..3195952ad2 Binary files /dev/null and b/examples/quick/touchinteraction/flickable/note-yellow.png differ diff --git a/examples/quick/touchinteraction/flickable/tack.png b/examples/quick/touchinteraction/flickable/tack.png new file mode 100644 index 0000000000..cef2d1cd23 Binary files /dev/null and b/examples/quick/touchinteraction/flickable/tack.png differ diff --git a/examples/quick/touchinteraction/multipointtouch/AugmentedTouchPoint.qml b/examples/quick/touchinteraction/multipointtouch/AugmentedTouchPoint.qml new file mode 100644 index 0000000000..56f287666f --- /dev/null +++ b/examples/quick/touchinteraction/multipointtouch/AugmentedTouchPoint.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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.0 +import QtQuick.Particles 2.0 + +//! [0] +TouchPoint { + id: container + property ParticleSystem system + onPressedChanged: { + if (pressed) { + timer.restart(); + child.enabled = true; + system.explode(x,y); + } + } + property QtObject obj: Timer { + id: timer + interval: 100 + running: false + repeat: false + onTriggered: container.child.enabled = false + } + property Item child: SpriteGoal { + enabled: false + x: container.area.x - 16 + y: container.area.y - 16 + width: container.area.width + 32 + height: container.area.height + 32 //+32 so it doesn't have to hit the exact center + system: container.system + parent: container.system + goalState: "falling" + } +} +//! [0] diff --git a/examples/quick/touchinteraction/multipointtouch/Bear0.png b/examples/quick/touchinteraction/multipointtouch/Bear0.png new file mode 100644 index 0000000000..f520cc1f1b Binary files /dev/null and b/examples/quick/touchinteraction/multipointtouch/Bear0.png differ diff --git a/examples/quick/touchinteraction/multipointtouch/Bear1.png b/examples/quick/touchinteraction/multipointtouch/Bear1.png new file mode 100644 index 0000000000..3b88f3b32e Binary files /dev/null and b/examples/quick/touchinteraction/multipointtouch/Bear1.png differ diff --git a/examples/quick/touchinteraction/multipointtouch/Bear2.png b/examples/quick/touchinteraction/multipointtouch/Bear2.png new file mode 100644 index 0000000000..337b636070 Binary files /dev/null and b/examples/quick/touchinteraction/multipointtouch/Bear2.png differ diff --git a/examples/quick/touchinteraction/multipointtouch/Bear3.png b/examples/quick/touchinteraction/multipointtouch/Bear3.png new file mode 100644 index 0000000000..f0e68590f4 Binary files /dev/null and b/examples/quick/touchinteraction/multipointtouch/Bear3.png differ diff --git a/examples/quick/touchinteraction/multipointtouch/BearB.png b/examples/quick/touchinteraction/multipointtouch/BearB.png new file mode 100644 index 0000000000..60be2b32c6 Binary files /dev/null and b/examples/quick/touchinteraction/multipointtouch/BearB.png differ diff --git a/examples/quick/touchinteraction/multipointtouch/BearWhackParticleSystem.qml b/examples/quick/touchinteraction/multipointtouch/BearWhackParticleSystem.qml new file mode 100644 index 0000000000..8da5949a1b --- /dev/null +++ b/examples/quick/touchinteraction/multipointtouch/BearWhackParticleSystem.qml @@ -0,0 +1,193 @@ +/**************************************************************************** +** +** Copyright (C) 2017 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.0 +import QtQuick.Particles 2.0 + +ParticleSystem { + id: particleSystem + + property int score + + function explode(x,y) { + fireEmitter.burst(100,x,y); + } + + Emitter { + id: emitter + group: "bears" + width: parent.width + emitRate: 1 + NumberAnimation on emitRate { + id: goFaster + from: 1 + to: 16 + running: particleSystem.running + loops: 1 + duration: 60000 * 5 + easing.type: Easing.Linear + } + lifeSpan: 4000 + 800*(16-emitRate) + maximumEmitted: 128 + size: 64 + velocity: PointDirection{ y: 40 + 10 * emitter.emitRate } + } + + Emitter { + id: fireEmitter + enabled: false + maximumEmitted: 6000 + group: "flame" + emitRate: 1000 + size: 16 + endSize: 8 + velocity: CumulativeDirection { AngleDirection {angleVariation: 180; magnitudeVariation: 120;} PointDirection { y: -60 }} + lifeSpan: 400 + } + Emitter { + id: heartEmitter + enabled: false + maximumEmitted: 6000 + group: "hearts" + emitRate: 1000 + size: 16 + endSize: 8 + velocity: AngleDirection {angleVariation: 180; magnitudeVariation: 180;} + lifeSpan: 600 + } + Emitter { + id: bloodEmitter + enabled: false + maximumEmitted: 6000 + group: "blood" + emitRate: 1000 + size: 16 + endSize: 8 + velocity: CumulativeDirection { AngleDirection {angleVariation: 180; magnitudeVariation: 80;} PointDirection { y: 40 }} + lifeSpan: 600 + } + + Affector { + width: parent.width + height: 64 + once: true + y: parent.height - 32 + groups: "bears" + onAffectParticles: function(particles) { + for (var i=0;itouchinteraction.qml flickable/basic-flickable.qml flickable/corkboards.qml - flickable/content/cork.jpg - flickable/content/note-yellow.png - flickable/content/Panel.qml - flickable/content/tack.png + flickable/cork.jpg + flickable/note-yellow.png + flickable/Panel.qml + flickable/tack.png multipointtouch/bearwhack.qml multipointtouch/multiflame.qml - multipointtouch/content/AugmentedTouchPoint.qml - multipointtouch/content/Bear0.png - multipointtouch/content/Bear1.png - multipointtouch/content/Bear2.png - multipointtouch/content/Bear3.png - multipointtouch/content/BearB.png - multipointtouch/content/BearWhackParticleSystem.qml - multipointtouch/content/blur-circle.png - multipointtouch/content/blur-circle3.png - multipointtouch/content/heart-blur.png - multipointtouch/content/ParticleFlame.qml - multipointtouch/content/title.png + multipointtouch/AugmentedTouchPoint.qml + multipointtouch/Bear0.png + multipointtouch/Bear1.png + multipointtouch/Bear2.png + multipointtouch/Bear3.png + multipointtouch/BearB.png + multipointtouch/BearWhackParticleSystem.qml + multipointtouch/blur-circle.png + multipointtouch/blur-circle3.png + multipointtouch/heart-blur.png + multipointtouch/ParticleFlame.qml + multipointtouch/title.png pincharea/flickresize.qml pincharea/qt-logo.jpg -- cgit v1.2.3