From 085dc352e7d97876df12461f4e18a26be2782e8c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 1 Sep 2021 14:50:10 +0200 Subject: Rename shapes example qml files according to what they demonstrate The order they are shown in the grid is not important; but users should be able to run any of these qml files directly without building the example, and appropriate names make the "right one" easier to find. Task-number: QTBUG-95739 Change-Id: I9751b52ce80bc08e12919ca3396c9d428d700a04 Reviewed-by: Oliver Eftevaag Reviewed-by: Ulf Hermann (cherry picked from commit 270a6f9bba75478204dc6aadb348cf34a195a4da) Reviewed-by: Qt Cherry-pick Bot --- examples/quick/shapes/CMakeLists.txt | 32 ++--- examples/quick/shapes/arcDirection.qml | 97 ++++++++++++++ examples/quick/shapes/arcRotation.qml | 113 +++++++++++++++++ examples/quick/shapes/capStyles.qml | 93 ++++++++++++++ examples/quick/shapes/cubicCurve.qml | 174 ++++++++++++++++++++++++++ examples/quick/shapes/dashPattern.qml | 98 +++++++++++++++ examples/quick/shapes/ellipticalArcs.qml | 115 +++++++++++++++++ examples/quick/shapes/fillRules.qml | 89 +++++++++++++ examples/quick/shapes/gradientSpreadModes.qml | 113 +++++++++++++++++ examples/quick/shapes/item10.qml | 174 -------------------------- examples/quick/shapes/item11.qml | 115 ----------------- examples/quick/shapes/item12.qml | 113 ----------------- examples/quick/shapes/item13.qml | 97 -------------- examples/quick/shapes/item14.qml | 91 -------------- examples/quick/shapes/item15.qml | 113 ----------------- examples/quick/shapes/item17.qml | 77 ------------ examples/quick/shapes/item18.qml | 71 ----------- examples/quick/shapes/item2.qml | 153 ---------------------- examples/quick/shapes/item3.qml | 98 --------------- examples/quick/shapes/item4.qml | 86 ------------- examples/quick/shapes/item5.qml | 89 ------------- examples/quick/shapes/item6.qml | 89 ------------- examples/quick/shapes/item7.qml | 95 -------------- examples/quick/shapes/item8.qml | 93 -------------- examples/quick/shapes/item9.qml | 100 --------------- examples/quick/shapes/joinStyles.qml | 95 ++++++++++++++ examples/quick/shapes/largeOrSmallArc.qml | 91 ++++++++++++++ examples/quick/shapes/linearGradient.qml | 86 +++++++++++++ examples/quick/shapes/quadraticCurve.qml | 100 +++++++++++++++ examples/quick/shapes/radialGradient.qml | 89 +++++++++++++ examples/quick/shapes/shapegallery.qml | 32 ++--- examples/quick/shapes/shapes.qrc | 32 ++--- examples/quick/shapes/strokeOrFill.qml | 153 ++++++++++++++++++++++ examples/quick/shapes/text.qml | 71 +++++++++++ examples/quick/shapes/tigerLoader.qml | 77 ++++++++++++ 35 files changed, 1702 insertions(+), 1702 deletions(-) create mode 100644 examples/quick/shapes/arcDirection.qml create mode 100644 examples/quick/shapes/arcRotation.qml create mode 100644 examples/quick/shapes/capStyles.qml create mode 100644 examples/quick/shapes/cubicCurve.qml create mode 100644 examples/quick/shapes/dashPattern.qml create mode 100644 examples/quick/shapes/ellipticalArcs.qml create mode 100644 examples/quick/shapes/fillRules.qml create mode 100644 examples/quick/shapes/gradientSpreadModes.qml delete mode 100644 examples/quick/shapes/item10.qml delete mode 100644 examples/quick/shapes/item11.qml delete mode 100644 examples/quick/shapes/item12.qml delete mode 100644 examples/quick/shapes/item13.qml delete mode 100644 examples/quick/shapes/item14.qml delete mode 100644 examples/quick/shapes/item15.qml delete mode 100644 examples/quick/shapes/item17.qml delete mode 100644 examples/quick/shapes/item18.qml delete mode 100644 examples/quick/shapes/item2.qml delete mode 100644 examples/quick/shapes/item3.qml delete mode 100644 examples/quick/shapes/item4.qml delete mode 100644 examples/quick/shapes/item5.qml delete mode 100644 examples/quick/shapes/item6.qml delete mode 100644 examples/quick/shapes/item7.qml delete mode 100644 examples/quick/shapes/item8.qml delete mode 100644 examples/quick/shapes/item9.qml create mode 100644 examples/quick/shapes/joinStyles.qml create mode 100644 examples/quick/shapes/largeOrSmallArc.qml create mode 100644 examples/quick/shapes/linearGradient.qml create mode 100644 examples/quick/shapes/quadraticCurve.qml create mode 100644 examples/quick/shapes/radialGradient.qml create mode 100644 examples/quick/shapes/strokeOrFill.qml create mode 100644 examples/quick/shapes/text.qml create mode 100644 examples/quick/shapes/tigerLoader.qml (limited to 'examples/quick') diff --git a/examples/quick/shapes/CMakeLists.txt b/examples/quick/shapes/CMakeLists.txt index ef4a5449c6..33eb935d7d 100644 --- a/examples/quick/shapes/CMakeLists.txt +++ b/examples/quick/shapes/CMakeLists.txt @@ -43,22 +43,22 @@ qt_add_qml_module(shapesexample QML_FILES "clippedtigers.qml" "interactive.qml" - "item10.qml" - "item11.qml" - "item12.qml" - "item13.qml" - "item14.qml" - "item15.qml" - "item17.qml" - "item18.qml" - "item2.qml" - "item3.qml" - "item4.qml" - "item5.qml" - "item6.qml" - "item7.qml" - "item8.qml" - "item9.qml" + "cubicCurve.qml" + "ellipticalArcs.qml" + "gradientSpreadModes.qml" + "arcDirection.qml" + "largeOrSmallArc.qml" + "arcRotation.qml" + "tigerLoader.qml" + "text.qml" + "strokeOrFill.qml" + "dashPattern.qml" + "linearGradient.qml" + "radialGradient.qml" + "fillRules.qml" + "joinStyles.qml" + "capStyles.qml" + "quadraticCurve.qml" "main.qml" "sampling.qml" "shapegallery.qml" diff --git a/examples/quick/shapes/arcDirection.qml b/examples/quick/shapes/arcDirection.qml new file mode 100644 index 0000000000..2c0fdfa623 --- /dev/null +++ b/examples/quick/shapes/arcDirection.qml @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + + Rectangle { + width: 100 + height: 100 + anchors.centerIn: parent + border.color: "gray" + + Repeater { + model: 2 + Shape { + anchors.fill: parent + + ShapePath { + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: ShapePath.DashLine + strokeWidth: 4 + + startX: 4; startY: 4 + PathArc { + id: arc + x: 96; y: 96 + radiusX: 100; radiusY: 100 + direction: model.index === 0 ? PathArc.Clockwise : PathArc.Counterclockwise + } + } + } + } + } + + Column { + anchors.right: parent.right + Text { + text: "Clockwise (sweep 1)" + color: "red" + } + Text { + text: "Counter clockwise (sweep 0)" + color: "blue" + } + } +} diff --git a/examples/quick/shapes/arcRotation.qml b/examples/quick/shapes/arcRotation.qml new file mode 100644 index 0000000000..3530e5e0fb --- /dev/null +++ b/examples/quick/shapes/arcRotation.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + + Repeater { + model: 2 + Shape { + width: 200 + height: 200 + anchors.centerIn: parent + + ShapePath { + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: ShapePath.DashLine + strokeWidth: 4 + + startX: 50; startY: 100 + PathArc { + x: 150; y: 100 + radiusX: 50; radiusY: 20 + xAxisRotation: model.index === 0 ? 0 : 45 + } + } + } + } + + Repeater { + model: 2 + Shape { + width: 200 + height: 200 + anchors.centerIn: parent + + ShapePath { + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + + startX: 50; startY: 100 + PathArc { + x: 150; y: 100 + radiusX: 50; radiusY: 20 + xAxisRotation: model.index === 0 ? 0 : 45 + direction: PathArc.Counterclockwise + } + } + } + } + + Column { + anchors.right: parent.right + Text { + text: "0 degrees" + color: "red" + } + Text { + text: "45 degrees" + color: "blue" + } + } +} diff --git a/examples/quick/shapes/capStyles.qml b/examples/quick/shapes/capStyles.qml new file mode 100644 index 0000000000..cc06a48501 --- /dev/null +++ b/examples/quick/shapes/capStyles.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + + Shape { + anchors.centerIn: parent + width: 200 + height: 100 + + ShapePath { + id: capTest + strokeColor: "green" + strokeWidth: 20 + fillColor: "transparent" + + property int capStyleIdx: 0 + property variant styles: [ ShapePath.FlatCap, ShapePath.SquareCap, ShapePath.RoundCap ] + property variant styleTexts: [ "FlatCap", "SquareCap", "RoundCap" ] + + capStyle: styles[capStyleIdx] + + startX: 40; startY: 30 + PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 } + PathLine { x: 150; y: 80 } + PathQuad { x: 160; y: 30; controlX: 200; controlY: 80 } + } + } + + Timer { + interval: 1000 + repeat: true + running: true + onTriggered: capTest.capStyleIdx = (capTest.capStyleIdx + 1) % capTest.styles.length + } + + Text { + id: txt + anchors.right: parent.right + text: capTest.styleTexts[capTest.capStyleIdx] + } +} diff --git a/examples/quick/shapes/cubicCurve.qml b/examples/quick/shapes/cubicCurve.qml new file mode 100644 index 0000000000..38ecb302ba --- /dev/null +++ b/examples/quick/shapes/cubicCurve.qml @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + + Item { + width: 200 + height: 200 + anchors.centerIn: parent + + Shape { + id: shape + anchors.fill: parent + + ShapePath { + strokeWidth: 4 + strokeColor: "black" + fillGradient: ConicalGradient { + id: conGrad + centerX: 100; centerY: 75 + NumberAnimation on angle { from: 0; to: 360; duration: 10000; loops: Animation.Infinite } + GradientStop { position: 0; color: "#00000000" } + GradientStop { position: 0.10; color: "#ffe0cc73" } + GradientStop { position: 0.17; color: "#ffc6a006" } + GradientStop { position: 0.46; color: "#ff600659" } + GradientStop { position: 0.72; color: "#ff0680ac" } + GradientStop { position: 0.92; color: "#ffb9d9e6" } + GradientStop { position: 1.00; color: "#00000000" } + } + + startX: 50; startY: 100 + PathCubic { + x: 150; y: 100 + control1X: cp1.x; control1Y: cp1.y + control2X: cp2.x; control2Y: cp2.y + } + } + } + + Rectangle { + id: cp1 + color: "red" + width: 10; height: 10 + SequentialAnimation { + loops: Animation.Infinite + running: true + NumberAnimation { + target: cp1 + property: "x" + from: 0 + to: shape.width - cp1.width + duration: 5000 + } + NumberAnimation { + target: cp1 + property: "x" + from: shape.width - cp1.width + to: 0 + duration: 5000 + } + NumberAnimation { + target: cp1 + property: "y" + from: 0 + to: shape.height - cp1.height + duration: 5000 + } + NumberAnimation { + target: cp1 + property: "y" + from: shape.height - cp1.height + to: 0 + duration: 5000 + } + } + } + + Rectangle { + id: cp2 + color: "blue" + width: 10; height: 10 + x: shape.width - width + SequentialAnimation { + loops: Animation.Infinite + running: true + NumberAnimation { + target: cp2 + property: "y" + from: 0 + to: shape.height - cp2.height + duration: 5000 + } + NumberAnimation { + target: cp2 + property: "y" + from: shape.height - cp2.height + to: 0 + duration: 5000 + } + NumberAnimation { + target: cp2 + property: "x" + from: shape.width - cp2.width + to: 0 + duration: 5000 + } + NumberAnimation { + target: cp2 + property: "x" + from: 0 + to: shape.width - cp2.width + duration: 5000 + } + } + } + } + + Text { + anchors.right: parent.right + anchors.top: parent.top + text: "Conical gradient angle: " + Math.round(conGrad.angle) + } +} diff --git a/examples/quick/shapes/dashPattern.qml b/examples/quick/shapes/dashPattern.qml new file mode 100644 index 0000000000..bcf6c40c3c --- /dev/null +++ b/examples/quick/shapes/dashPattern.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + Shape { + width: 200 + height: 150 + anchors.centerIn: parent + ShapePath { + strokeWidth: 4 + strokeColor: "red" + fillGradient: RadialGradient { + centerX: 100; centerY: 100; centerRadius: 100 + SequentialAnimation on focalRadius { + loops: Animation.Infinite + NumberAnimation { from: 1; to: 20; duration: 2000 } + NumberAnimation { from: 20; to: 1; duration: 2000 } + } + SequentialAnimation on focalX { + loops: Animation.Infinite + NumberAnimation { from: 50; to: 150; duration: 3000 } + NumberAnimation { from: 150; to: 50; duration: 3000 } + } + SequentialAnimation on focalY { + loops: Animation.Infinite + NumberAnimation { from: 50; to: 150; duration: 1000 } + NumberAnimation { from: 150; to: 50; duration: 1000 } + } + GradientStop { position: 0; color: "#ffffff" } + GradientStop { position: 0.11; color: "#f9ffa0" } + GradientStop { position: 0.13; color: "#f9ff99" } + GradientStop { position: 0.14; color: "#f3ff86" } + GradientStop { position: 0.49; color: "#93b353" } + GradientStop { position: 0.87; color: "#264619" } + GradientStop { position: 0.96; color: "#0c1306" } + GradientStop { position: 1; color: "#000000" } + } + fillColor: "blue" // ignored with the gradient set + strokeStyle: ShapePath.DashLine + dashPattern: [ 1, 4 ] + startX: 20; startY: 20 + PathLine { x: 180; y: 130 } + PathLine { x: 20; y: 130 } + PathLine { x: 20; y: 20 } + } + } +} diff --git a/examples/quick/shapes/ellipticalArcs.qml b/examples/quick/shapes/ellipticalArcs.qml new file mode 100644 index 0000000000..09cc2c8211 --- /dev/null +++ b/examples/quick/shapes/ellipticalArcs.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + Shape { + id: shape + width: 220 + height: 200 + anchors.centerIn: parent + + ShapePath { + fillGradient: LinearGradient { + y2: shape.height + GradientStop { position: 0; color: "yellow" } + GradientStop { position: 1; color: "green" } + } + + startX: 10; startY: 100 + PathArc { + relativeX: 50; y: 100 + radiusX: 25; radiusY: 25 + } + PathArc { + relativeX: 50; y: 100 + radiusX: 25; radiusY: 35 + } + PathArc { + relativeX: 50; y: 100 + radiusX: 25; radiusY: 60 + } + PathArc { + relativeX: 50; y: 100 + radiusX: 50; radiusY: 120 + } + } + } + + Shape { + width: 120 + height: 130 + anchors.bottom: parent.bottom + anchors.right: parent.right + + scale: 0.5 + + ShapePath { + fillColor: "transparent" + strokeColor: "darkBlue" + strokeWidth: 20 + capStyle: ShapePath.RoundCap + + PathAngleArc { + centerX: 65; centerY: 95 + radiusX: 45; radiusY: 45 + startAngle: -180 + SequentialAnimation on sweepAngle { + loops: Animation.Infinite + NumberAnimation { to: 360; duration: 2000 } + NumberAnimation { to: 0; duration: 2000 } + } + } + } + } +} diff --git a/examples/quick/shapes/fillRules.qml b/examples/quick/shapes/fillRules.qml new file mode 100644 index 0000000000..6300ced608 --- /dev/null +++ b/examples/quick/shapes/fillRules.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + Shape { + width: 100 + height: 100 + anchors.centerIn: parent + ShapePath { + id: star + strokeColor: "blue" + fillColor: "magenta" + strokeWidth: 2 + PathMove { x: 90; y: 50 } + PathLine { x: 50 + 40 * Math.cos(0.8 * 1 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 1 * Math.PI) } + PathLine { x: 50 + 40 * Math.cos(0.8 * 2 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 2 * Math.PI) } + PathLine { x: 50 + 40 * Math.cos(0.8 * 3 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 3 * Math.PI) } + PathLine { x: 50 + 40 * Math.cos(0.8 * 4 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 4 * Math.PI) } + PathLine { x: 90; y: 50 } + } + NumberAnimation on rotation { + from: 0 + to: 360 + duration: 5000 + loops: Animation.Infinite + } + } + Timer { + interval: 2000 + onTriggered: star.fillRule = (star.fillRule === ShapePath.OddEvenFill ? ShapePath.WindingFill : ShapePath.OddEvenFill) + repeat: true + running: true + } + Text { + anchors.right: parent.right + text: star.fillRule === ShapePath.OddEvenFill ? "OddEvenFill" : "WindingFill" + } +} diff --git a/examples/quick/shapes/gradientSpreadModes.qml b/examples/quick/shapes/gradientSpreadModes.qml new file mode 100644 index 0000000000..6e39a90f55 --- /dev/null +++ b/examples/quick/shapes/gradientSpreadModes.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + Rectangle { + border.color: "black" + width: 200 + height: 200 + anchors.centerIn: parent + + Shape { + anchors.fill: parent + + ShapePath { + strokeColor: "transparent" + + fillGradient: LinearGradient { + id: grad + y1: 50; y2: 150 + GradientStop { position: 0; color: "black" } + GradientStop { position: 1; color: "red" } + } + + startX: 10; startY: 10 + PathLine { relativeX: 180; relativeY: 0 } + PathLine { relativeX: 0; relativeY: 180 } + PathLine { relativeX: -180; relativeY: 0 } + PathLine { relativeX: 0; relativeY: -180 } + } + } + + Timer { + id: spreadTimer + interval: 3000 + running: true + repeat: true + property variant spreads: [ ShapeGradient.PadSpread, ShapeGradient.RepeatSpread, ShapeGradient.ReflectSpread ] + property variant spreadTexts: [ "PadSpread", "RepeatSpread", "ReflectSpread" ] + property int spreadIdx: 0 + onTriggered: { spreadIdx = (spreadIdx + 1) % spreads.length; grad.spread = spreads[spreadIdx] } + } + + + Shape { + anchors.fill: parent + ShapePath { + strokeColor: "gray" + strokeWidth: 2 + fillColor: "transparent" + PathMove { x: 0; y: 50 } + PathLine { relativeX: 200; relativeY: 0 } + PathMove { x: 0; y: 150 } + PathLine { relativeX: 200; relativeY: 0 } + } + } + } + + Text { + anchors.right: parent.right + text: spreadTimer.spreadTexts[spreadTimer.spreadIdx] + } +} diff --git a/examples/quick/shapes/item10.qml b/examples/quick/shapes/item10.qml deleted file mode 100644 index 38ecb302ba..0000000000 --- a/examples/quick/shapes/item10.qml +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - - Item { - width: 200 - height: 200 - anchors.centerIn: parent - - Shape { - id: shape - anchors.fill: parent - - ShapePath { - strokeWidth: 4 - strokeColor: "black" - fillGradient: ConicalGradient { - id: conGrad - centerX: 100; centerY: 75 - NumberAnimation on angle { from: 0; to: 360; duration: 10000; loops: Animation.Infinite } - GradientStop { position: 0; color: "#00000000" } - GradientStop { position: 0.10; color: "#ffe0cc73" } - GradientStop { position: 0.17; color: "#ffc6a006" } - GradientStop { position: 0.46; color: "#ff600659" } - GradientStop { position: 0.72; color: "#ff0680ac" } - GradientStop { position: 0.92; color: "#ffb9d9e6" } - GradientStop { position: 1.00; color: "#00000000" } - } - - startX: 50; startY: 100 - PathCubic { - x: 150; y: 100 - control1X: cp1.x; control1Y: cp1.y - control2X: cp2.x; control2Y: cp2.y - } - } - } - - Rectangle { - id: cp1 - color: "red" - width: 10; height: 10 - SequentialAnimation { - loops: Animation.Infinite - running: true - NumberAnimation { - target: cp1 - property: "x" - from: 0 - to: shape.width - cp1.width - duration: 5000 - } - NumberAnimation { - target: cp1 - property: "x" - from: shape.width - cp1.width - to: 0 - duration: 5000 - } - NumberAnimation { - target: cp1 - property: "y" - from: 0 - to: shape.height - cp1.height - duration: 5000 - } - NumberAnimation { - target: cp1 - property: "y" - from: shape.height - cp1.height - to: 0 - duration: 5000 - } - } - } - - Rectangle { - id: cp2 - color: "blue" - width: 10; height: 10 - x: shape.width - width - SequentialAnimation { - loops: Animation.Infinite - running: true - NumberAnimation { - target: cp2 - property: "y" - from: 0 - to: shape.height - cp2.height - duration: 5000 - } - NumberAnimation { - target: cp2 - property: "y" - from: shape.height - cp2.height - to: 0 - duration: 5000 - } - NumberAnimation { - target: cp2 - property: "x" - from: shape.width - cp2.width - to: 0 - duration: 5000 - } - NumberAnimation { - target: cp2 - property: "x" - from: 0 - to: shape.width - cp2.width - duration: 5000 - } - } - } - } - - Text { - anchors.right: parent.right - anchors.top: parent.top - text: "Conical gradient angle: " + Math.round(conGrad.angle) - } -} diff --git a/examples/quick/shapes/item11.qml b/examples/quick/shapes/item11.qml deleted file mode 100644 index 09cc2c8211..0000000000 --- a/examples/quick/shapes/item11.qml +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - Shape { - id: shape - width: 220 - height: 200 - anchors.centerIn: parent - - ShapePath { - fillGradient: LinearGradient { - y2: shape.height - GradientStop { position: 0; color: "yellow" } - GradientStop { position: 1; color: "green" } - } - - startX: 10; startY: 100 - PathArc { - relativeX: 50; y: 100 - radiusX: 25; radiusY: 25 - } - PathArc { - relativeX: 50; y: 100 - radiusX: 25; radiusY: 35 - } - PathArc { - relativeX: 50; y: 100 - radiusX: 25; radiusY: 60 - } - PathArc { - relativeX: 50; y: 100 - radiusX: 50; radiusY: 120 - } - } - } - - Shape { - width: 120 - height: 130 - anchors.bottom: parent.bottom - anchors.right: parent.right - - scale: 0.5 - - ShapePath { - fillColor: "transparent" - strokeColor: "darkBlue" - strokeWidth: 20 - capStyle: ShapePath.RoundCap - - PathAngleArc { - centerX: 65; centerY: 95 - radiusX: 45; radiusY: 45 - startAngle: -180 - SequentialAnimation on sweepAngle { - loops: Animation.Infinite - NumberAnimation { to: 360; duration: 2000 } - NumberAnimation { to: 0; duration: 2000 } - } - } - } - } -} diff --git a/examples/quick/shapes/item12.qml b/examples/quick/shapes/item12.qml deleted file mode 100644 index 6e39a90f55..0000000000 --- a/examples/quick/shapes/item12.qml +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - Rectangle { - border.color: "black" - width: 200 - height: 200 - anchors.centerIn: parent - - Shape { - anchors.fill: parent - - ShapePath { - strokeColor: "transparent" - - fillGradient: LinearGradient { - id: grad - y1: 50; y2: 150 - GradientStop { position: 0; color: "black" } - GradientStop { position: 1; color: "red" } - } - - startX: 10; startY: 10 - PathLine { relativeX: 180; relativeY: 0 } - PathLine { relativeX: 0; relativeY: 180 } - PathLine { relativeX: -180; relativeY: 0 } - PathLine { relativeX: 0; relativeY: -180 } - } - } - - Timer { - id: spreadTimer - interval: 3000 - running: true - repeat: true - property variant spreads: [ ShapeGradient.PadSpread, ShapeGradient.RepeatSpread, ShapeGradient.ReflectSpread ] - property variant spreadTexts: [ "PadSpread", "RepeatSpread", "ReflectSpread" ] - property int spreadIdx: 0 - onTriggered: { spreadIdx = (spreadIdx + 1) % spreads.length; grad.spread = spreads[spreadIdx] } - } - - - Shape { - anchors.fill: parent - ShapePath { - strokeColor: "gray" - strokeWidth: 2 - fillColor: "transparent" - PathMove { x: 0; y: 50 } - PathLine { relativeX: 200; relativeY: 0 } - PathMove { x: 0; y: 150 } - PathLine { relativeX: 200; relativeY: 0 } - } - } - } - - Text { - anchors.right: parent.right - text: spreadTimer.spreadTexts[spreadTimer.spreadIdx] - } -} diff --git a/examples/quick/shapes/item13.qml b/examples/quick/shapes/item13.qml deleted file mode 100644 index 2c0fdfa623..0000000000 --- a/examples/quick/shapes/item13.qml +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - - Rectangle { - width: 100 - height: 100 - anchors.centerIn: parent - border.color: "gray" - - Repeater { - model: 2 - Shape { - anchors.fill: parent - - ShapePath { - fillColor: "transparent" - strokeColor: model.index === 0 ? "red" : "blue" - strokeStyle: ShapePath.DashLine - strokeWidth: 4 - - startX: 4; startY: 4 - PathArc { - id: arc - x: 96; y: 96 - radiusX: 100; radiusY: 100 - direction: model.index === 0 ? PathArc.Clockwise : PathArc.Counterclockwise - } - } - } - } - } - - Column { - anchors.right: parent.right - Text { - text: "Clockwise (sweep 1)" - color: "red" - } - Text { - text: "Counter clockwise (sweep 0)" - color: "blue" - } - } -} diff --git a/examples/quick/shapes/item14.qml b/examples/quick/shapes/item14.qml deleted file mode 100644 index b7fa8fa6ab..0000000000 --- a/examples/quick/shapes/item14.qml +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - - Repeater { - model: 2 - Shape { - width: 200 - height: 200 - anchors.centerIn: parent - - ShapePath { - fillColor: "transparent" - strokeColor: model.index === 0 ? "red" : "blue" - strokeStyle: ShapePath.DashLine - strokeWidth: 4 - - startX: 50; startY: 100 - PathArc { - x: 100; y: 150 - radiusX: 50; radiusY: 50 - useLargeArc: model.index === 1 - } - } - } - } - - Column { - anchors.right: parent.right - Text { - text: "Small" - color: "red" - } - Text { - text: "Large" - color: "blue" - } - } -} diff --git a/examples/quick/shapes/item15.qml b/examples/quick/shapes/item15.qml deleted file mode 100644 index 3530e5e0fb..0000000000 --- a/examples/quick/shapes/item15.qml +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - - Repeater { - model: 2 - Shape { - width: 200 - height: 200 - anchors.centerIn: parent - - ShapePath { - fillColor: "transparent" - strokeColor: model.index === 0 ? "red" : "blue" - strokeStyle: ShapePath.DashLine - strokeWidth: 4 - - startX: 50; startY: 100 - PathArc { - x: 150; y: 100 - radiusX: 50; radiusY: 20 - xAxisRotation: model.index === 0 ? 0 : 45 - } - } - } - } - - Repeater { - model: 2 - Shape { - width: 200 - height: 200 - anchors.centerIn: parent - - ShapePath { - fillColor: "transparent" - strokeColor: model.index === 0 ? "red" : "blue" - - startX: 50; startY: 100 - PathArc { - x: 150; y: 100 - radiusX: 50; radiusY: 20 - xAxisRotation: model.index === 0 ? 0 : 45 - direction: PathArc.Counterclockwise - } - } - } - } - - Column { - anchors.right: parent.right - Text { - text: "0 degrees" - color: "red" - } - Text { - text: "45 degrees" - color: "blue" - } - } -} diff --git a/examples/quick/shapes/item17.qml b/examples/quick/shapes/item17.qml deleted file mode 100644 index 366d8e329b..0000000000 --- a/examples/quick/shapes/item17.qml +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - - Item { - anchors.fill: parent - - Text { - anchors.centerIn: parent - text: "Loading" - // Phase #1: Loader loads tiger.qml. After this we have our item. - // Phase #2: With some backends (generic) the item will start async processing. Wait for this too. - visible: shapeLoader.status != Loader.Ready || shapeLoader.item.status === Shape.Processing - } - - Loader { - id: shapeLoader - anchors.fill: parent - source: "tiger.qml" - asynchronous: true - visible: status == Loader.Ready - scale: 0.4 - } - } -} diff --git a/examples/quick/shapes/item18.qml b/examples/quick/shapes/item18.qml deleted file mode 100644 index c61b070405..0000000000 --- a/examples/quick/shapes/item18.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - - Shape { - anchors.centerIn: parent - width: 200 - height: 100 - - ShapePath { - id: capTest - strokeColor: "black" - strokeWidth: 1 - fillColor: "black" - - PathText { x: 0; y: 0; font.family: "Arial"; font.pixelSize: 150; text: "Qt!" } - } - } -} diff --git a/examples/quick/shapes/item2.qml b/examples/quick/shapes/item2.qml deleted file mode 100644 index 47841f1a68..0000000000 --- a/examples/quick/shapes/item2.qml +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - - Shape { - id: circ1 - anchors.fill: parent - - ShapePath { - id: p1 - fillColor: "transparent" // stroke only - strokeWidth: 4 - - SequentialAnimation on strokeColor { - loops: Animation.Infinite - ColorAnimation { - from: "black" - to: "yellow" - duration: 5000 - } - ColorAnimation { - from: "yellow" - to: "green" - duration: 5000 - } - ColorAnimation { - from: "green" - to: "black" - duration: 5000 - } - } - - property real r: 60 - startX: circ1.width / 2 - r - startY: circ1.height / 2 - r - PathArc { - x: circ1.width / 2 + p1.r - y: circ1.height / 2 + p1.r - radiusX: p1.r; radiusY: p1.r - useLargeArc: true - } - PathArc { - x: circ1.width / 2 - p1.r - y: circ1.height / 2 - p1.r - radiusX: p1.r; radiusY: p1.r - useLargeArc: true - } - } - } - - Shape { - id: circ2 - anchors.fill: parent - - SequentialAnimation on opacity { - loops: Animation.Infinite - NumberAnimation { from: 1.0; to: 0.0; duration: 5000 } - NumberAnimation { from: 0.0; to: 1.0; duration: 5000 } - } - - ShapePath { - id: p2 - strokeWidth: -1 // or strokeColor: "transparent" - - SequentialAnimation on fillColor { - loops: Animation.Infinite - ColorAnimation { - from: "gray" - to: "purple" - duration: 3000 - } - ColorAnimation { - from: "purple" - to: "red" - duration: 3000 - } - ColorAnimation { - from: "red" - to: "gray" - duration: 3000 - } - } - - property real r: 40 - startX: circ2.width / 2 - r - startY: circ2.height / 2 - r - PathArc { - x: circ2.width / 2 + p2.r - y: circ2.height / 2 + p2.r - radiusX: p2.r; radiusY: p2.r - useLargeArc: true - } - PathArc { - x: circ2.width / 2 - p2.r - y: circ2.height / 2 - p2.r - radiusX: p2.r; radiusY: p2.r - useLargeArc: true - } - } - } -} diff --git a/examples/quick/shapes/item3.qml b/examples/quick/shapes/item3.qml deleted file mode 100644 index bcf6c40c3c..0000000000 --- a/examples/quick/shapes/item3.qml +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - Shape { - width: 200 - height: 150 - anchors.centerIn: parent - ShapePath { - strokeWidth: 4 - strokeColor: "red" - fillGradient: RadialGradient { - centerX: 100; centerY: 100; centerRadius: 100 - SequentialAnimation on focalRadius { - loops: Animation.Infinite - NumberAnimation { from: 1; to: 20; duration: 2000 } - NumberAnimation { from: 20; to: 1; duration: 2000 } - } - SequentialAnimation on focalX { - loops: Animation.Infinite - NumberAnimation { from: 50; to: 150; duration: 3000 } - NumberAnimation { from: 150; to: 50; duration: 3000 } - } - SequentialAnimation on focalY { - loops: Animation.Infinite - NumberAnimation { from: 50; to: 150; duration: 1000 } - NumberAnimation { from: 150; to: 50; duration: 1000 } - } - GradientStop { position: 0; color: "#ffffff" } - GradientStop { position: 0.11; color: "#f9ffa0" } - GradientStop { position: 0.13; color: "#f9ff99" } - GradientStop { position: 0.14; color: "#f3ff86" } - GradientStop { position: 0.49; color: "#93b353" } - GradientStop { position: 0.87; color: "#264619" } - GradientStop { position: 0.96; color: "#0c1306" } - GradientStop { position: 1; color: "#000000" } - } - fillColor: "blue" // ignored with the gradient set - strokeStyle: ShapePath.DashLine - dashPattern: [ 1, 4 ] - startX: 20; startY: 20 - PathLine { x: 180; y: 130 } - PathLine { x: 20; y: 130 } - PathLine { x: 20; y: 20 } - } - } -} diff --git a/examples/quick/shapes/item4.qml b/examples/quick/shapes/item4.qml deleted file mode 100644 index 426fb144c2..0000000000 --- a/examples/quick/shapes/item4.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - Shape { - id: shape - anchors.fill: parent - - ShapePath { - id: p - strokeWidth: 5 - strokeColor: "blue" - strokeStyle: ShapePath.DashLine - dashPattern: [ 1, 4, 4, 4 ] - fillColor: "lightBlue" - - property real xr: 70 - property real yr: 30 - startX: shape.width / 2 - xr - startY: shape.height / 2 - yr - PathArc { - x: shape.width / 2 + p.xr - y: shape.height / 2 + p.yr - radiusX: p.xr; radiusY: p.yr - useLargeArc: true - } - PathArc { - x: shape.width / 2 - p.xr - y: shape.height / 2 - p.yr - radiusX: p.xr; radiusY: p.yr - useLargeArc: true - } - } - } -} diff --git a/examples/quick/shapes/item5.qml b/examples/quick/shapes/item5.qml deleted file mode 100644 index 0eb9a4631e..0000000000 --- a/examples/quick/shapes/item5.qml +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - Shape { - width: 200 - height: 150 - anchors.centerIn: parent - ShapePath { - strokeWidth: 4 - strokeColor: "red" - fillGradient: LinearGradient { - x1: 20; y1: 20 - x2: 180; y2: 130 - GradientStop { position: 0; color: "blue" } - GradientStop { position: 0.2; color: "green" } - GradientStop { position: 0.4; color: "red" } - GradientStop { position: 0.6; color: "yellow" } - GradientStop { position: 1; color: "cyan" } - } - fillColor: "blue" // ignored with the gradient set - strokeStyle: ShapePath.DashLine - dashPattern: [ 1, 4 ] - startX: 20; startY: 20 - PathLine { x: 180; y: 130 } - PathLine { x: 20; y: 130 } - PathLine { x: 20; y: 20 } - } - transform: Rotation { origin.x: 100; origin.y: 50; axis { x: 0; y: 1; z: 0 } - SequentialAnimation on angle { - NumberAnimation { from: 0; to: 75; duration: 2000 } - NumberAnimation { from: 75; to: -75; duration: 4000 } - NumberAnimation { from: -75; to: 0; duration: 2000 } - loops: Animation.Infinite - } - } - } -} diff --git a/examples/quick/shapes/item6.qml b/examples/quick/shapes/item6.qml deleted file mode 100644 index 6300ced608..0000000000 --- a/examples/quick/shapes/item6.qml +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - Shape { - width: 100 - height: 100 - anchors.centerIn: parent - ShapePath { - id: star - strokeColor: "blue" - fillColor: "magenta" - strokeWidth: 2 - PathMove { x: 90; y: 50 } - PathLine { x: 50 + 40 * Math.cos(0.8 * 1 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 1 * Math.PI) } - PathLine { x: 50 + 40 * Math.cos(0.8 * 2 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 2 * Math.PI) } - PathLine { x: 50 + 40 * Math.cos(0.8 * 3 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 3 * Math.PI) } - PathLine { x: 50 + 40 * Math.cos(0.8 * 4 * Math.PI); y: 50 + 40 * Math.sin(0.8 * 4 * Math.PI) } - PathLine { x: 90; y: 50 } - } - NumberAnimation on rotation { - from: 0 - to: 360 - duration: 5000 - loops: Animation.Infinite - } - } - Timer { - interval: 2000 - onTriggered: star.fillRule = (star.fillRule === ShapePath.OddEvenFill ? ShapePath.WindingFill : ShapePath.OddEvenFill) - repeat: true - running: true - } - Text { - anchors.right: parent.right - text: star.fillRule === ShapePath.OddEvenFill ? "OddEvenFill" : "WindingFill" - } -} diff --git a/examples/quick/shapes/item7.qml b/examples/quick/shapes/item7.qml deleted file mode 100644 index ed34c1de77..0000000000 --- a/examples/quick/shapes/item7.qml +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - - Shape { - width: 120 - height: 120 - anchors.centerIn: parent - - ShapePath { - id: joinTest - - strokeColor: "black" - strokeWidth: 16 - fillColor: "transparent" - capStyle: ShapePath.RoundCap - - property int joinStyleIdx: 0 - property variant styles: [ ShapePath.BevelJoin, ShapePath.MiterJoin, ShapePath.RoundJoin ] - property variant styleTexts: [ "BevelJoin", "MiterJoin", "RoundJoin" ] - - joinStyle: styles[joinStyleIdx] - - startX: 30 - startY: 30 - PathLine { x: 100; y: 100 } - PathLine { x: 30; y: 100 } - } - } - - Timer { - interval: 1000 - repeat: true - running: true - onTriggered: joinTest.joinStyleIdx = (joinTest.joinStyleIdx + 1) % joinTest.styles.length - } - - Text { - id: txt - anchors.right: parent.right - text: joinTest.styleTexts[joinTest.joinStyleIdx] - } -} diff --git a/examples/quick/shapes/item8.qml b/examples/quick/shapes/item8.qml deleted file mode 100644 index cc06a48501..0000000000 --- a/examples/quick/shapes/item8.qml +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - - Shape { - anchors.centerIn: parent - width: 200 - height: 100 - - ShapePath { - id: capTest - strokeColor: "green" - strokeWidth: 20 - fillColor: "transparent" - - property int capStyleIdx: 0 - property variant styles: [ ShapePath.FlatCap, ShapePath.SquareCap, ShapePath.RoundCap ] - property variant styleTexts: [ "FlatCap", "SquareCap", "RoundCap" ] - - capStyle: styles[capStyleIdx] - - startX: 40; startY: 30 - PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 } - PathLine { x: 150; y: 80 } - PathQuad { x: 160; y: 30; controlX: 200; controlY: 80 } - } - } - - Timer { - interval: 1000 - repeat: true - running: true - onTriggered: capTest.capStyleIdx = (capTest.capStyleIdx + 1) % capTest.styles.length - } - - Text { - id: txt - anchors.right: parent.right - text: capTest.styleTexts[capTest.capStyleIdx] - } -} diff --git a/examples/quick/shapes/item9.qml b/examples/quick/shapes/item9.qml deleted file mode 100644 index c4ef8ccf79..0000000000 --- a/examples/quick/shapes/item9.qml +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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.Shapes - -Rectangle { - color: "lightGray" - - Item { - width: 200 - height: 100 - anchors.centerIn: parent - - Shape { - id: shape - anchors.fill: parent - - ShapePath { - strokeWidth: 4 - strokeColor: "black" - fillColor: "transparent" - - startX: 50 - startY: 50 - PathQuad { - x: 150; y: 50 - controlX: cp.x; controlY: cp.y - } - } - } - - Rectangle { - id: cp - color: "red" - width: 10 - height: 10 - SequentialAnimation on x { - loops: Animation.Infinite - NumberAnimation { - from: 0 - to: shape.width - cp.width - duration: 5000 - } - NumberAnimation { - from: shape.width - cp.width - to: 0 - duration: 5000 - } - } - } - } -} diff --git a/examples/quick/shapes/joinStyles.qml b/examples/quick/shapes/joinStyles.qml new file mode 100644 index 0000000000..ed34c1de77 --- /dev/null +++ b/examples/quick/shapes/joinStyles.qml @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + + Shape { + width: 120 + height: 120 + anchors.centerIn: parent + + ShapePath { + id: joinTest + + strokeColor: "black" + strokeWidth: 16 + fillColor: "transparent" + capStyle: ShapePath.RoundCap + + property int joinStyleIdx: 0 + property variant styles: [ ShapePath.BevelJoin, ShapePath.MiterJoin, ShapePath.RoundJoin ] + property variant styleTexts: [ "BevelJoin", "MiterJoin", "RoundJoin" ] + + joinStyle: styles[joinStyleIdx] + + startX: 30 + startY: 30 + PathLine { x: 100; y: 100 } + PathLine { x: 30; y: 100 } + } + } + + Timer { + interval: 1000 + repeat: true + running: true + onTriggered: joinTest.joinStyleIdx = (joinTest.joinStyleIdx + 1) % joinTest.styles.length + } + + Text { + id: txt + anchors.right: parent.right + text: joinTest.styleTexts[joinTest.joinStyleIdx] + } +} diff --git a/examples/quick/shapes/largeOrSmallArc.qml b/examples/quick/shapes/largeOrSmallArc.qml new file mode 100644 index 0000000000..b7fa8fa6ab --- /dev/null +++ b/examples/quick/shapes/largeOrSmallArc.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + + Repeater { + model: 2 + Shape { + width: 200 + height: 200 + anchors.centerIn: parent + + ShapePath { + fillColor: "transparent" + strokeColor: model.index === 0 ? "red" : "blue" + strokeStyle: ShapePath.DashLine + strokeWidth: 4 + + startX: 50; startY: 100 + PathArc { + x: 100; y: 150 + radiusX: 50; radiusY: 50 + useLargeArc: model.index === 1 + } + } + } + } + + Column { + anchors.right: parent.right + Text { + text: "Small" + color: "red" + } + Text { + text: "Large" + color: "blue" + } + } +} diff --git a/examples/quick/shapes/linearGradient.qml b/examples/quick/shapes/linearGradient.qml new file mode 100644 index 0000000000..426fb144c2 --- /dev/null +++ b/examples/quick/shapes/linearGradient.qml @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + Shape { + id: shape + anchors.fill: parent + + ShapePath { + id: p + strokeWidth: 5 + strokeColor: "blue" + strokeStyle: ShapePath.DashLine + dashPattern: [ 1, 4, 4, 4 ] + fillColor: "lightBlue" + + property real xr: 70 + property real yr: 30 + startX: shape.width / 2 - xr + startY: shape.height / 2 - yr + PathArc { + x: shape.width / 2 + p.xr + y: shape.height / 2 + p.yr + radiusX: p.xr; radiusY: p.yr + useLargeArc: true + } + PathArc { + x: shape.width / 2 - p.xr + y: shape.height / 2 - p.yr + radiusX: p.xr; radiusY: p.yr + useLargeArc: true + } + } + } +} diff --git a/examples/quick/shapes/quadraticCurve.qml b/examples/quick/shapes/quadraticCurve.qml new file mode 100644 index 0000000000..c4ef8ccf79 --- /dev/null +++ b/examples/quick/shapes/quadraticCurve.qml @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + + Item { + width: 200 + height: 100 + anchors.centerIn: parent + + Shape { + id: shape + anchors.fill: parent + + ShapePath { + strokeWidth: 4 + strokeColor: "black" + fillColor: "transparent" + + startX: 50 + startY: 50 + PathQuad { + x: 150; y: 50 + controlX: cp.x; controlY: cp.y + } + } + } + + Rectangle { + id: cp + color: "red" + width: 10 + height: 10 + SequentialAnimation on x { + loops: Animation.Infinite + NumberAnimation { + from: 0 + to: shape.width - cp.width + duration: 5000 + } + NumberAnimation { + from: shape.width - cp.width + to: 0 + duration: 5000 + } + } + } + } +} diff --git a/examples/quick/shapes/radialGradient.qml b/examples/quick/shapes/radialGradient.qml new file mode 100644 index 0000000000..0eb9a4631e --- /dev/null +++ b/examples/quick/shapes/radialGradient.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + Shape { + width: 200 + height: 150 + anchors.centerIn: parent + ShapePath { + strokeWidth: 4 + strokeColor: "red" + fillGradient: LinearGradient { + x1: 20; y1: 20 + x2: 180; y2: 130 + GradientStop { position: 0; color: "blue" } + GradientStop { position: 0.2; color: "green" } + GradientStop { position: 0.4; color: "red" } + GradientStop { position: 0.6; color: "yellow" } + GradientStop { position: 1; color: "cyan" } + } + fillColor: "blue" // ignored with the gradient set + strokeStyle: ShapePath.DashLine + dashPattern: [ 1, 4 ] + startX: 20; startY: 20 + PathLine { x: 180; y: 130 } + PathLine { x: 20; y: 130 } + PathLine { x: 20; y: 20 } + } + transform: Rotation { origin.x: 100; origin.y: 50; axis { x: 0; y: 1; z: 0 } + SequentialAnimation on angle { + NumberAnimation { from: 0; to: 75; duration: 2000 } + NumberAnimation { from: 75; to: -75; duration: 4000 } + NumberAnimation { from: -75; to: 0; duration: 2000 } + loops: Animation.Infinite + } + } + } +} diff --git a/examples/quick/shapes/shapegallery.qml b/examples/quick/shapes/shapegallery.qml index 6870ea1465..79d438d492 100644 --- a/examples/quick/shapes/shapegallery.qml +++ b/examples/quick/shapes/shapegallery.qml @@ -72,67 +72,67 @@ Rectangle { } ListElement { name: "Stroke or fill only" - shapeUrl: "item2.qml" + shapeUrl: "strokeOrFill.qml" } ListElement { name: "Dash pattern" - shapeUrl: "item4.qml" + shapeUrl: "linearGradient.qml" } ListElement { name: "Linear gradient" - shapeUrl: "item5.qml" + shapeUrl: "radialGradient.qml" } ListElement { name: "Radial gradient" - shapeUrl: "item3.qml" + shapeUrl: "dashPattern.qml" } ListElement { name: "Fill rules" - shapeUrl: "item6.qml" + shapeUrl: "fillRules.qml" } ListElement { name: "Join styles" - shapeUrl: "item7.qml" + shapeUrl: "joinStyles.qml" } ListElement { name: "Cap styles" - shapeUrl: "item8.qml" + shapeUrl: "capStyles.qml" } ListElement { name: "Quadratic curve" - shapeUrl: "item9.qml" + shapeUrl: "quadraticCurve.qml" } ListElement { name: "Cubic curve" - shapeUrl: "item10.qml" + shapeUrl: "cubicCurve.qml" } ListElement { name: "Elliptical arc" - shapeUrl: "item11.qml" + shapeUrl: "ellipticalArcs.qml" } ListElement { name: "Gradient spread modes" - shapeUrl: "item12.qml" + shapeUrl: "gradientSpreadModes.qml" } ListElement { name: "Arc direction" - shapeUrl: "item13.qml" + shapeUrl: "arcDirection.qml" } ListElement { name: "Large/small arc" - shapeUrl: "item14.qml" + shapeUrl: "largeOrSmallArc.qml" } ListElement { name: "Arc rotation" - shapeUrl: "item15.qml" + shapeUrl: "arcRotation.qml" } ListElement { name: "Tiger" - shapeUrl: "item17.qml" + shapeUrl: "tigerLoader.qml" } ListElement { name: "Text" - shapeUrl: "item18.qml" + shapeUrl: "text.qml" } } diff --git a/examples/quick/shapes/shapes.qrc b/examples/quick/shapes/shapes.qrc index 84f4e8a1dc..60bf842a3a 100644 --- a/examples/quick/shapes/shapes.qrc +++ b/examples/quick/shapes/shapes.qrc @@ -7,21 +7,21 @@ clippedtigers.qml tiger.qml tapableTriangle.qml - item2.qml - item3.qml - item4.qml - item5.qml - item6.qml - item7.qml - item8.qml - item9.qml - item10.qml - item11.qml - item12.qml - item13.qml - item14.qml - item15.qml - item17.qml - item18.qml + strokeOrFill.qml + dashPattern.qml + linearGradient.qml + radialGradient.qml + fillRules.qml + joinStyles.qml + capStyles.qml + quadraticCurve.qml + cubicCurve.qml + ellipticalArcs.qml + gradientSpreadModes.qml + arcDirection.qml + largeOrSmallArc.qml + arcRotation.qml + tigerLoader.qml + text.qml diff --git a/examples/quick/shapes/strokeOrFill.qml b/examples/quick/shapes/strokeOrFill.qml new file mode 100644 index 0000000000..47841f1a68 --- /dev/null +++ b/examples/quick/shapes/strokeOrFill.qml @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + + Shape { + id: circ1 + anchors.fill: parent + + ShapePath { + id: p1 + fillColor: "transparent" // stroke only + strokeWidth: 4 + + SequentialAnimation on strokeColor { + loops: Animation.Infinite + ColorAnimation { + from: "black" + to: "yellow" + duration: 5000 + } + ColorAnimation { + from: "yellow" + to: "green" + duration: 5000 + } + ColorAnimation { + from: "green" + to: "black" + duration: 5000 + } + } + + property real r: 60 + startX: circ1.width / 2 - r + startY: circ1.height / 2 - r + PathArc { + x: circ1.width / 2 + p1.r + y: circ1.height / 2 + p1.r + radiusX: p1.r; radiusY: p1.r + useLargeArc: true + } + PathArc { + x: circ1.width / 2 - p1.r + y: circ1.height / 2 - p1.r + radiusX: p1.r; radiusY: p1.r + useLargeArc: true + } + } + } + + Shape { + id: circ2 + anchors.fill: parent + + SequentialAnimation on opacity { + loops: Animation.Infinite + NumberAnimation { from: 1.0; to: 0.0; duration: 5000 } + NumberAnimation { from: 0.0; to: 1.0; duration: 5000 } + } + + ShapePath { + id: p2 + strokeWidth: -1 // or strokeColor: "transparent" + + SequentialAnimation on fillColor { + loops: Animation.Infinite + ColorAnimation { + from: "gray" + to: "purple" + duration: 3000 + } + ColorAnimation { + from: "purple" + to: "red" + duration: 3000 + } + ColorAnimation { + from: "red" + to: "gray" + duration: 3000 + } + } + + property real r: 40 + startX: circ2.width / 2 - r + startY: circ2.height / 2 - r + PathArc { + x: circ2.width / 2 + p2.r + y: circ2.height / 2 + p2.r + radiusX: p2.r; radiusY: p2.r + useLargeArc: true + } + PathArc { + x: circ2.width / 2 - p2.r + y: circ2.height / 2 - p2.r + radiusX: p2.r; radiusY: p2.r + useLargeArc: true + } + } + } +} diff --git a/examples/quick/shapes/text.qml b/examples/quick/shapes/text.qml new file mode 100644 index 0000000000..c61b070405 --- /dev/null +++ b/examples/quick/shapes/text.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + + Shape { + anchors.centerIn: parent + width: 200 + height: 100 + + ShapePath { + id: capTest + strokeColor: "black" + strokeWidth: 1 + fillColor: "black" + + PathText { x: 0; y: 0; font.family: "Arial"; font.pixelSize: 150; text: "Qt!" } + } + } +} diff --git a/examples/quick/shapes/tigerLoader.qml b/examples/quick/shapes/tigerLoader.qml new file mode 100644 index 0000000000..366d8e329b --- /dev/null +++ b/examples/quick/shapes/tigerLoader.qml @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module 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.Shapes + +Rectangle { + color: "lightGray" + + Item { + anchors.fill: parent + + Text { + anchors.centerIn: parent + text: "Loading" + // Phase #1: Loader loads tiger.qml. After this we have our item. + // Phase #2: With some backends (generic) the item will start async processing. Wait for this too. + visible: shapeLoader.status != Loader.Ready || shapeLoader.item.status === Shape.Processing + } + + Loader { + id: shapeLoader + anchors.fill: parent + source: "tiger.qml" + asynchronous: true + visible: status == Loader.Ready + scale: 0.4 + } + } +} -- cgit v1.2.3